Plotting a graph to show the variation in time of a current
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have the following current with the expression:
i =13*sqrt(2)*sqrt(2)*sin(2* pi*40*t-8.13)
and i want to plot the variation in time over 1.5 period.
I tried something i have seen on the cummunity:
period = 1/40
Periods = 1.5 * period
t = linspace(0,Periods, 1000);
i =13*sqrt(2)*sqrt(2)*sin(2* pi * t/period-8.13);
plot(t, i, 'b-', 'LineWidth', 2);
grid on;
and it shows this graph:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1165253/image.png)
but the correct graph i know is this one:![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1165258/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1165258/image.png)
(the blue line is for the current i wrote above)
Can somebody help me write the correct code to obtain the correct results?
Thank you!
1 个评论
dpb
2022-10-22
i =13*sqrt(2)*sqrt(2)*sin(2* pi*40*t-8.13)
What's the point of sqrt(2)*sqrt(2) in the above? That's just 2 identically.
There's no way to produce the other figure from your code without defining three timeseries; the three there all have differing amplitudes and phase shifts (although the bue one is pretty near zero, it isn't quite) and they're all over what appears to be identically 2 periods, not 1.5.
You'll have to define what those curves are supposed to be representing first...
回答(1 个)
Sameer Pujari
2022-10-25
Hi Eduard Mihai
Upon reproducing your code, I understood that the issue you are facing is due to not converting the phase angle from degree's to radian's
Use of "sin" in MATLAB returns sine of argument in radians. Converting phase from degree to radians gives the desired correct graph
i =13*sqrt(2)*sqrt(2)*sin(2* pi*40*t-8.13*pi/180)
I hope this information helps you!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!