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 comentarios

Walter Roberson
Walter Roberson el 10 de Mayo de 2023
When you run your function by pressing the green Run button, where are you expecting MATLAB to look for values for z?
Roos
Roos el 11 de Mayo de 2023
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).

Iniciar sesión para comentar.

 Respuesta aceptada

Torsten
Torsten el 10 de Mayo de 2023
Movida: Torsten el 10 de Mayo de 2023

0 votos

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)

Más respuestas (0)

Categorías

Más información sobre Language Fundamentals en Centro de ayuda y File Exchange.

Productos

Versión

R2023a

Preguntada:

el 10 de Mayo de 2023

Comentada:

el 11 de Mayo de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by