Plotting two functions that depend on boundary conditions.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
SnukeN3
el 18 de Nov. de 2018
Comentada: madhan ravi
el 18 de Nov. de 2018
I have two functions,
V_lamp_off(t)=Vs+(Voff-Vs)*y and V_lamp_on(t)=Vth+(Von-Vth)*exp(z). I want to plot V_lamp_off when the value is between 1 and 4 and plot V_lamp_on when the value is between 4 and 1. The length of the plot is driven by t. I can plot the two functions individually but want to show the shark tooth wave form. I've tried an if/then sequence with no luck.
if V_lamp_off <= Voff
then a = V_lamp_off;
elseif V_lamp_off >= Von
then a = V_lamp_on;
elseif V_lamp_on <= Voff
then a =V_lamp_off;
end
plot (t,a)
Any help would be appreciated.
1 comentario
Respuesta aceptada
madhan ravi
el 18 de Nov. de 2018
Editada: madhan ravi
el 18 de Nov. de 2018
"I want to plot V_lamp_off when the value is between 1 and 4 and plot "
Which value do you mean?
Instead of
if V_lamp_off <= Voff
then a = V_lamp_off;
elseif V_lamp_off >= Von
then a = V_lamp_on;
elseif V_lamp_on <= Voff
then a =V_lamp_off;
end
plot (t,a)
should be
a=ones(1,numel(t))
idx=(V_lamp_off <= Voff )
a(idx)=V_lamp_off(idx)
iddx=(V_lamp_off >= Von)
a(idx)=V_lamp_on(idx)
plot(t,a)
Más respuestas (3)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots 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!