trying to index whole sine wave positively with time stamp
조회 수: 1 (최근 30일)
이전 댓글 표시
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.
댓글 수: 0
답변 (1개)
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!
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!