MATLAB Answers

Lizan
0

Simple calculations?

Asked by Lizan
on 20 May 2011
I would like to find dn1/dn2 in matlab and I have two vectors n1 and n2.
How can I find dn1/dn2 the simplest way? Are there any inbuilt functions for these kind of calculations?

  0 Comments

Sign in to comment.

3 Answers

Answer by Andy
on 20 May 2011
 Accepted Answer

Perhaps you're looking for
res = diff(n1)./diff(n2); %?

  1 Comment

Lizan
on 20 May 2011
Yes, the function diff works since DIFF(X), for a vector X, is [X(2)-X(1) X(3)-X(2) ... X(n)-X(n-1)].
Many thanks!
I knew it was simple.

Sign in to comment.


Answer by Jan
on 20 May 2011

Do you want to calculate the derivative of one vector according to the other? Do you expect the result to be a matrix? Or are you looking for the GRADIENT command?

  0 Comments

Sign in to comment.


Answer by Adetunji
on 19 Jan 2012

x =90 91 92 93 94 95 96 97 98 99 100 y=54 55 54 54 57 57 63 56 57 56 56
am trying to compute the gradient of the above in matlab..any idea?

  0 Comments

Sign in to comment.