Unable to run my function even though my textbook was able to get it done this way...
even when I put the value of fs in, it still gives errors...

댓글 수: 2

Walter Roberson
Walter Roberson 2023년 5월 10일
When you run your function by pressing the green Run button, where are you expecting MATLAB to look for values for z?
Roos
Roos 2023년 5월 11일
I was asked to test dfdt using the test signal: and check if the plotted signal resembles the analytically obtained derivative of z(t) = sin(2*pi*f*t).

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

 채택된 답변

Torsten
Torsten 2023년 5월 10일
이동: Torsten 2023년 5월 10일

0 개 추천

The code line in the loop must read
za(i) = (z(i+1)-z(i-1))/(2*h)
instead of
za(i) = (z(i+1)-(i-1))/(2*h)
And call the function with reasonable inputs, e.g.
x = 0:0.1:1;
z = sin(x);
fs = 10;
za = dfdt(z,fs)
plot(x,za)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Language Fundamentals에 대해 자세히 알아보기

제품

릴리스

R2023a

질문:

2023년 5월 10일

댓글:

2023년 5월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by