I'm trying to plot this graph with the x-values between -10 and 50, but the graph plots them between 0 and 60?
1 回表示 (過去 30 日間)
古いコメントを表示
a = bin2dec('00010101') b = bin2dec('00010010') c = bin2dec('11000101')
x =[(-10):1:50]
y1 = (-b.*((x-a).^2))+c y2 = (c.*x)-a
hold on plot (y1) plot (y2)
0 件のコメント
採用された回答
Jan
2017 年 10 月 10 日
編集済み: Jan
2017 年 10 月 10 日
a = bin2dec('00010101');
b = bin2dec('00010010');
c = bin2dec('11000101')
x = -10:50; % Nicer and faster than: [(-10):1:50]
y1 = (-b.*((x-a).^2))+c;
y2 = (c.*x)-a;
plot(x, y1);
hold on
plot(x, y2);
You need to specify x in the plot() command, otherwise Matlab assumes it is 1:length(y).
See http://www.mathworks.com/matlabcentral/answers/35676-why-not-use-square-brackets for the unneeded square brackets.
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!