trying to index whole sine wave positively with time stamp

1 回表示 (過去 30 日間)
ALI DRIDI
ALI DRIDI 2020 年 8 月 13 日
回答済み: Maadhav Akula 2020 年 8 月 18 日
Hi, i was trying to plot the positive magnitude of the sine wave as a simulation for the rectified voltage the problem is when i use (idx) for plotting the positive magnitude i cant plot it with the time stamp even i used linsplace to equal the time variable (T = 0:(1/(100*F)):(10/F); ) with DC_Voltage=((Vdc) * sin((2)*(pi*F)*(T))); but an error shows to me that the input variables are not equal in length,below is the private function used:
function Output_Voltage(app,Vdc,F,T)
DC_Voltage = ((Vdc) * sin((2)*(pi*F)*(T)));
idx = DC_Voltage>=0;
plot(app.UIAxes,DC_Voltage(idx));
app.UIAxes.Title.String = 'Rectified DC Voltage';
hold(app.UIAxes,'off')
app.UIAxes.YLabel.String = 'Vdc';
end
---------------------------------------------------------------------------------------------------
this is the output that i get from plot(app.UIAxes,DC_Voltage(idx)); without time stamp, but when i do plot(app.UIAxes,T,DC_Voltage(idx)); I get the error message.

回答 (1 件)

Maadhav Akula
Maadhav Akula 2020 年 8 月 18 日
Hi,
Both the inputs to plot function should be equal in length, so you can do the following to plot the Positive cycle of sine-wave:
plot(app.UIAxes,T(idx),DC_Voltage(idx));
Hope this helps!

カテゴリ

Help Center および File ExchangeSemiconductors and Converters についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by