MATLAB help

cranky

cranky

@cranky-E9J79q Oct 26, 2024
Hey,
>>I have two arrays A and B.
>>Now I want the derivative of B with respect to A at all points of A.
>>So i move on to express B=f(A).
>>i use polyfit function and get the function f.
>>then i do f1=diff(f)
Now i am facing two problems:
1.when i express b=f(a) like y=x^4+(.02*x^3) and so on,it says " Error using ==> mpower
Matrix must be square."
2.it also says "Attempted to access f1(2); index out of bounds because numel(f1)=1."

what mistakes am i doing?😔😒

Thanks in advance.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • durga ch

    durga ch

    @durga-TpX3gO Jul 3, 2010

    what is A array and dimensions of A? and whats B , what function of A is B?
  • cranky

    cranky

    @cranky-E9J79q Jul 3, 2010

    Hello there,
    For now lets say A=[1 2 3 4 5],B=[55 88 99 101 145].B=f(A) will be taken care of by polyfit right?
  • risingsun

    risingsun

    @risingsun-xPMIMl Jul 3, 2010

    try using '.^' instead of '^' ..it should solve your problem 😀
  • durga ch

    durga ch

    @durga-TpX3gO Jul 3, 2010

    Rising Sun is right. Since you are manipulating each element of the array, you should be going for a '.' function. Cranky, can you try as what rising sun suggested?
  • cranky

    cranky

    @cranky-E9J79q Jul 10, 2010

    thank you.I will update you on that
  • WhAcK-O-NuT

    WhAcK-O-NuT

    @whack-o-nut-8cJjXn Jul 12, 2010

    Hello there people ! Cranky, I suggest you consider buying MATLAB's book written by RUDRA PRATAP. It's really good and shall assist you a great deal. It is a small book and is not expensive.😁
  • jerseys

    jerseys

    @jerseys-XvFmiP Jul 16, 2010

    what function of A is B?




    #-Link-Snipped-#