Periodic function. How would I make this function repeat itself for, let's say, -1 to 3 seconds or something?

9 次查看(过去 30 天)
clear;clc;
Vm =1 ; % Amplitude of signal T= 1 ; % Period
syms t;
v1 = Vm*sin((4*pi*t)/T);
v2= 2*Vm*sin((4*pi*t)/T);
v = piecewise(0<=t<=T/2,v1,T/2<=t<=T,v2);
figure;
fplot (t,v) ;
grid on xlabel('time s ');
ylabel('Voltage V ');
title('v(t) vs t ');
legend('v ')
  1 个评论
Image Analyst
Image Analyst 2019-10-24
Original question in case dummy erases this one too:
Periodic function. How would I make this function repeat itself for, let's say, -1 to 3 seconds or something?
clear;clc;
Vm =1 ; % Amplitude of signal T= 1 ; % Period
syms t;
v1 = Vm*sin((4*pi*t)/T);
v2= 2*Vm*sin((4*pi*t)/T);
v = piecewise(0<=t<=T/2,v1,T/2<=t<=T,v2);
figure;
fplot (t,v) ;
grid on xlabel('time s ');
ylabel('Voltage V ');
title('v(t) vs t ');
legend('v ')

请先登录,再进行评论。

回答(1 个)

Geoff Hayes
Geoff Hayes 2019-4-20
A for loop could be used. Perhaps something like
for t=-1:3
% use t in your code
end

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by