plot 2 graphic but continous
plot 2 graphic but continous
(OP)
i need someone's help n i have a question
How to plot two or more functions but they are cointinous.
the functions maybe like:
y1=2*x for 0<x<2
y2=4 for 2<x<4
y3=2 for x>4
how to plot them in a cartesian coordinate, together.
following illustration is what i want to plot!!
_____
/
/ _______
/
/
how i can do that with standar ploting matlab command...?
(x and y are symbolic expression)
please help me! thank's a lot.
How to plot two or more functions but they are cointinous.
the functions maybe like:
y1=2*x for 0<x<2
y2=4 for 2<x<4
y3=2 for x>4
how to plot them in a cartesian coordinate, together.
following illustration is what i want to plot!!
_____
/
/ _______
/
/
how i can do that with standar ploting matlab command...?
(x and y are symbolic expression)
please help me! thank's a lot.





RE: plot 2 graphic but continous
x=0:.1:10;
plot(x,yourfunctionname(x));
function [ y ] = yfunc( x )
%YFUNC Summary of this function goes here
% Detailed explanation goes here
for i=1:size(x,1)
if x(i,1) > 0 & x(i,1) <= 2
y(i,1)=2*x(i,1);
elseif x(i,1)>2 & x(i,1)<4
y(i,1)=4;
elseif x(i,1)>4
y(i,1)=2;
else
y(i,1)=NaN;
end
end