フィルターのクリア

Plot of Quadratic Equation coming out Linear...What do I do??? Emergency

1 回表示 (過去 30 日間)
Lauren
Lauren 2014 年 3 月 4 日
編集済み: Roger Stafford 2014 年 3 月 4 日
Here is my plot code
clear all
x=[-10:1:10];
y1=-x+x.^2/(1+x.^2);
y2=-.5*x + x.^2/(1+x.^2);
y3=-.2*x+x.^2/(1+x.^2);
plot(x,y1,'r',x,y2,'b',x,y3,'g')
It should look like three different versions of a differential curve with increasing parameter values, but all three plots come out linear. Looks correct on another graphing site. What am I doing wrong?

採用された回答

Roger Stafford
Roger Stafford 2014 年 3 月 4 日
編集済み: Roger Stafford 2014 年 3 月 4 日
Try putting a dot on your division symbols:
y1=-x+x.^2./(1+x.^2);
As you have it the division is matlab's matrix division which in this case gives a scalar value, hence the linear appearance.
See
http://www.mathworks.com/help/matlab/ref/mrdivide.html

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by