What am I doing wrong?
1 回表示 (過去 30 日間)
古いコメントを表示
I am following a line of code from a MATLAB book line for line but keep getting this error code and I'm not understanding why.
>> f = @(mu,x) mu*x-x.^3;
>> x = linspace(-5,5);
>> f_many = [f(-5,x) f(0,x) f(5,x) f(45,x)];
>> plot(x,f_many)
Error using plot
Vectors must be the same length.
0 件のコメント
回答 (1 件)
Abdolkarim Mohammadi
2020 年 9 月 22 日
編集済み: Abdolkarim Mohammadi
2020 年 9 月 22 日
For drawing multiple line plots at once, you should have one column vector for each line. You just need to have x as a column vector. f_many will also be an array with four columns.
x = linspace (-5,5)';
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!