Plotting two functions that depend on boundary conditions.
조회 수: 3 (최근 30일)
이전 댓글 표시
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.
채택된 답변
madhan ravi
2018년 11월 18일
편집: madhan ravi
2018년 11월 18일
"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)
추가 답변 (3개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!