WHich loops or command should i use in order to plot this equation? It has 3 variables: v,x,t
1 次查看(过去 30 天)
显示 更早的评论
回答(1 个)
Mehmed Saad
2020-4-15
编辑:Mehmed Saad
2020-4-15
define x,t of same length i.e. select a sampling rate
fs = 10;%Hz
Now define time
t = 0:1/fs:100-1/fs;
x = linspace(0,2*pi,length(t));
i_t = 1.414*sin(w*t+phi);
Now Run the for loop for t
i = 1:length(x)
Now index 1 by 1 and sum them
Remember there are two nested for loop, 1 is for v and other for t
2 个评论
Mehmed Saad
2020-4-16
- yes you need another loop for x
- you can nest for loop as x t and v or t x and v
- You should follow nyquist rate as your frequency is 60Hz so you need atleast 120Hz fs
- x size can differ from t, it is not necessary
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!