CrazyEngineers
  • Matlab assignment help

    gargoor

    Member

    Updated: Oct 26, 2024
    Views: 1.1K
    such assignment pulled my attentiona and i took a while in solving it but then i reachd some friends and they said my answer isnt convincing enough
    diffirintiating (calling function) ,
    just maybe some1 around knows better in dealing with such quastions in matlab

    Here it is:


    Description

    Write a user defined function to calculate (numerical) the derivative of a polynomial function. The name of this user defined function must be: plot_dif_func Calling for plot_dif_func a plot of the derivative of the polynomial function must be created and numerical data must be generated as well. This numerical output consist of two arrays, one for the argument(x) and one for the calculated (dy/dx).

    Don’t forget to add some help text within the function-file. Lookfor build in functions like sqrt(x),sin(x), cos(x),…

    · The function definition line, must look like:

    function[argument,dydx]=plot_dif_func(polynomial_func, variable)

    · polynomial_func: This is the place where you type the polynomial fnction. For example if you have a input-func-tion like:
    h(x)=2*x.^3+2*x+3 then you type 2*x.^3+2*x+3
    instead of the text "polynomial_func"

    · variable: This is the place where you type the name of the variable for the input-function (x). Because this variable is also used outside the function, it should be defined before calling the function
    plot_dif_func .

    After calling de function plot_dif_func you will also have 2 output vectors called argument and dydx. These two vectors can be used to plot the derivative of the arbitrary function in a second plot window.


    and this is my answer , if some1 can help me understand more the question it'll be awesome cz what i know is calling function and the rest i just did it impulsivly , not sure if it make sense

    i'll post it within short notice

    if some1 is good at matlab i would be gladful even if i get a bit of clues and hints ,

    cheers
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • gargoor

    MemberMar 22, 2009

    Re: Matlab

    function[argument,dydx]=plot_dif_func(f_y,x)
    x=linspace(-2,2,20)
    % just randomly chozen numbers
    f_y=((x.^2)-(x)+(1))./((x.^2)+(x)+1) %just randomly chosen function
    %x=variables
    %f_y=polynomial function
    %dydx=the derivative of the veriable
    %argument=the derivative of the polynomial function
    dydx=diff(x); % just to clearify what is dydx
    argument=diff(f_y);
    Z=argument./dydx
    % i added this command so the output can be plotted because without this command the output graph will be straight line
    subplot(121)
    plot(x,f_y,
    'k')
    title(
    'graph of inputs')
    subplot(122)
    plot(Z)
    title(
    'graph of outputs')
    end
    Are you sure? This action cannot be undone.
    Cancel
  • gargoor

    MemberMar 22, 2009

    Re: Matlab

    can some 1 explain also for me what arbitrary is ? in math and in common life usage of the word ,
    Are you sure? This action cannot be undone.
    Cancel
  • gohm

    MemberMar 22, 2009

    It means "at random"

    <a href="https://www.merriam-webster.com/dictionary/arbitrary" target="_blank" rel="nofollow noopener noreferrer">Arbitrary Definition & Meaning - Merriam-Webster</a>
    Are you sure? This action cannot be undone.
    Cancel
  • Predictor

    MemberMar 24, 2009

    Re: Matlab

    gargoor
    can some 1 explain also for me what arbitrary is ? in math and in common life usage of the word ,
    In everyday use, as was indicated, "arbitrary" means "at random". In a statistical context, though, we would more specifically note that things which are "arbitrary" do not necessarily have known probability distributions. In other words, asking people to arbitrarily pick numbers from 1 to 10 is unlikely to result in a uniform distribution of values from 1 through 10.


    -Will Dwinnell
    <a href="https://matlabdatamining.blogspot.com/" target="_blank" rel="nofollow noopener noreferrer">Data Mining in MATLAB</a>
    Are you sure? This action cannot be undone.
    Cancel
  • gargoor

    MemberApr 11, 2009

    no one likes matlab around here 😛 to bother solving such assignment ?!
    Are you sure? This action cannot be undone.
    Cancel
  • silverscorpion

    MemberApr 12, 2009

    Clearly state what is your doubt in this assignment. also, tell what you want exactly.

    I saw the code, and I thin nothing is wrong with it.
    Apparently, many MATLAB enthusiasts are here, and I'm one too.
    So, you've to first make us understand what you need, so we can help you.
    Are you sure? This action cannot be undone.
    Cancel
  • gargoor

    MemberApr 12, 2009

    ,, i totally cleared what's my question up ?! i think its totally undertandable but no worries , .. for now thanks for your answer
    beside the questions marks i included up , i got one more Q,

    * what will be the difference if i clearified the variables (inputs+outputs) befor writing this statement
    function[argument,dydx]=plot_dif_func(f_y,x)
    ???
    Are you sure? This action cannot be undone.
    Cancel
  • gargoor

    MemberApr 16, 2009

    this's Terriffic, bunch of thanks for all you
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register