フィルターのクリア

code for slope and intercept of a straight line

2 ビュー (過去 30 日間)
bachir
bachir 2015 年 10 月 19 日
コメント済み: bachir 2015 年 10 月 19 日
I keep getting "matrix dimensions must agree error" and error in line 2 here's my code below
% code
x =(-2:0.02:2);
y = (m*x)+b; <==================================line 2
m = input('enter the slope m');
b = input('enter the intercept b');
subplot(1,1,1)
plot(x,y,'r'), xlabel('x'),ylabel('y'), axis([-2 2 -1 1])

採用された回答

Image Analyst
Image Analyst 2015 年 10 月 19 日
Line 2 needs to come AFTER the m= and b= lines. How else will y know what they are???
  1 件のコメント
bachir
bachir 2015 年 10 月 19 日
thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by