Hello guys ! I would like to ask you some questions about plotting a periodic signal. I have the following signal:
I represented it on 37 periods . I would like to represent on 37 periods, the signal y2 with the property:
For y1 i have T1 = 0.5, for y2 T2=1, y3 T3=2.
How can i change the period of my signal in the following code ? Or should i write it otherwise ?
Thank you !
This is my code for y1:
%y1(t)
T_1 = 0.5;
t = linspace(0,1,100);
x = 0.86*t.^2-2.05*t+0.97;
v = ones(1,37*2);
for i=1:37*2
if mod(i,2) == 1
v(i)=-v(i);
end
end
y1 = x(:);
y1 = y1*v;
y1 = y1(:);
T1 = linspace(0,37,3700*2);
figure(2);
plot(T1,y1,'r','LineWidth',1.5);
grid on;
grid minor;
xlabel('t[ms]', 'fontweight', 'bold', 'fontsize', 16, 'FontName', 'Times New Roman');
ylabel('y_{1}(t)','fontweight','bold','fontsize', 16, 'FontName', 'Times New Roman');
title('Reprezentare grafica a semnalului y_{1}(t) pe 37 de perioade','fontweight','bold','fontsize',16, 'FontName', 'Times New Roman');

 Réponse acceptée

Cris LaPierre
Cris LaPierre le 30 Déc 2020
Modifié(e) : Cris LaPierre le 30 Déc 2020

0 votes

You define T_1, but never use it in your code. I don't know what your result should look like, but the most obvious place to incorporate your period is in your code to create t.
T_1 = 0.5;
t = linspace(0,2*T_1,100);
You should then be able to just adjust the value of T_1 and the rest of the code should adjust accordingly.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Produits

Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by