trying to index whole sine wave positively with time stamp

1 visualización (últimos 30 días)
ALI DRIDI
ALI DRIDI el 13 de Ag. de 2020
Respondida: Maadhav Akula el 18 de Ag. de 2020
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.

Respuestas (1)

Maadhav Akula
Maadhav Akula el 18 de Ag. de 2020
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!

Categorías

Más información sobre Semiconductors and Converters en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by