MATLAB will not plot figure correctly -
why matlab plot figure straight horizontal line? y1 = (1+(x/2))/(1-(x/2));
what wrong code?
the function supposed resemble e^x. thank you. code here below.
x = linspace(0,3); y1 = (1+(x/2))/(1-(x/2)); %plot lines. figure plot(x,y1)
as @nkjt pointed out:
do know difference between /
, ./
if want divide pointwise, have use ./
, otherwise result of vector
(1+(x/2)) divided (1+(x/2))
what want is:
x = linspace(0,3); y1 = (1+(x/2))./(1-(x/2)); figure, plot(x,y1)
Comments
Post a Comment