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 ExchangeLanguage 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