CrazyEngineers
  • MATLAB help

    cranky

    Member

    Updated: Oct 26, 2024
    Views: 1.1K
    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.
    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
  • durga ch

    MemberJul 3, 2010

    what is A array and dimensions of A? and whats B , what function of A is B?
    Are you sure? This action cannot be undone.
    Cancel
  • cranky

    MemberJul 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?
    Are you sure? This action cannot be undone.
    Cancel
  • risingsun

    MemberJul 3, 2010

    try using '.^' instead of '^' ..it should solve your problem 😀
    Are you sure? This action cannot be undone.
    Cancel
  • durga ch

    MemberJul 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?
    Are you sure? This action cannot be undone.
    Cancel
  • cranky

    MemberJul 10, 2010

    thank you.I will update you on that
    Are you sure? This action cannot be undone.
    Cancel
  • WhAcK-O-NuT

    MemberJul 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.😁
    Are you sure? This action cannot be undone.
    Cancel
  • jerseys

    MemberJul 16, 2010

    what function of A is B?




    #-Link-Snipped-#
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register