Hello I am working on Emotion Recognition Project and i have extracted features they are in matrix forms and now i want to calcuate the (differential/derivative) of that matrix .... i have check many examples but didnt get much...
ex: i have a column vector then How we can calculate the derivative of that column vector....
Regards

답변 (2개)

Image Analyst
Image Analyst 2011년 10월 23일

0 개 추천

Did you try the gradient() function? Or use diff()? Or convolve with [1 -1] using conv()?

댓글 수: 3

Umair Riaz
Umair Riaz 2011년 10월 24일
hi thnaks for reply
I used diff function basically i am using this example
The quantity diff(y)./diff(x) is an approximate derivative.
x = [1 2 3 4 5];
y = diff(x)
y =
1 1 1 1
the only thing is confusing me is that if we see the formula
it says d(y)./d(x) is approximate deivative and then the difference of x vector and it become y . y=diff(x); then it take again diff of y and divide it with difference of x.
so it means that we can take derivative like this is it right way to take derivative?
1:diff(diff(x))./diff(x) or 2:diff(x,2)./diff(x)
thnaks ....
Image Analyst
Image Analyst 2011년 10월 24일
No. Don't do that. I guess you could say it's approximate because it's quantized. But you probably don't need to worry about it. Why don't you try some of the other methods and see what kind of images they produce? Or post your image and tell us what you want to find in it?
Jan
Jan 2011년 10월 24일
If you want to calculate the derivative, the values of x have to be measured at different times or locations. E.g. for getting d/dt it matters if the values of x are measures every second, every hour or in not equidistant time steps. For images the pixels have usually the same spatial distance, which can be assumed to be 1.0, except if you want to compare picture taken with different hardware. Now call your values "Img" to avoid confusion with the location in X-direction:
Img = [1,2,3,4,5]; x = [0,1,2,3,4];
"d(Img)/dx": dx = diff(Img) ./ diff(x);
This has 4 elements only. GRADIENT uses the more stable two-sided difference quotient for the interior points:
dx = gradient(Img, x); This has 5 elements.

댓글을 달려면 로그인하십시오.

John
John 2023년 8월 5일

0 개 추천

clc;
syms x
f = @(x) sin(x);
x = pi/2;
h = 0.0001;
d = (f(x+h)-f(x-h)/2*h)

카테고리

질문:

2011년 10월 23일

답변:

2023년 8월 5일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by