How can I plot this periodic function?
63 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mohammad Sharifi
el 30 de Mzo. de 2023
Comentada: Paul
el 30 de Mzo. de 2023
Hi,
I have the signal which is periodic:
F(t) = te^(2t), -2 < t < 2 , Period T=4
I want to graph this periodicaly for -5 < t < 6
Can anyone help?
Thanks in Advance!!
0 comentarios
Respuesta aceptada
Jack
el 30 de Mzo. de 2023
Hi,
Sure I can help you with that
% Define the function F(t)
F = @(t) t.*exp(2*t);
% Define the period and the time range to plot
T = 4;
t = linspace(-5, 6, 1000);
% Compute the periodic signal using the modulo function
F_periodic = F(mod(t, T) - T/2);
% Plot the periodic signal
plot(t, F_periodic);
xlabel('t');
ylabel('F(t)');
title('Periodic signal F(t) = te^(2t), T = 4');
In this code, we first define the function F(t) using an anonymous function. Then we define the period T and the time range to plot using the linspace function. We use the mod function to compute the periodic signal by taking the remainder of t/T and shifting it by T/2. Finally, we plot the periodic signal using the plot function and add labels and a title to the plot using the xlabel, ylabel, and title functions.
2 comentarios
Paul
el 30 de Mzo. de 2023
I don't think this code is correct.
% Define the function F(t)
F = @(t) t.*exp(2*t);
% Define the period and the time range to plot
T = 4;
t = linspace(-5, 6, 1000);
% Compute the periodic signal using the modulo function
F_periodic = F(mod(t, T) - T/2);
% Plot the periodic signal
plot(t, F_periodic);
Now compare to the original function over the stated interval
hold on
t = linspace(-2,2,100);
plot(t,F(t))
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!