HOW CAN I CORRECT THIS ?

x=[0:0.01:5];
y=exp(-1.5*x).*sin(10*x);
subplot(1,2,1);
plot(x,y);
xlabel('x'),ylabel('exp(-1.5*x).*sin(10*x)'),axis([0 5 -1 1])
y=exp(-2*x).*sin(10*x);
subplot(1,2,2);
plot(x,y);
xlabel('x'),ylabel('exp(-2*x)*sin(10*x)'),axis([0 5 -1 1])
but when i try to run it.. this shows:
plotting
Attempt to execute SCRIPT plot as a function:
C:\Users\lenovo\Documents\MATLAB\plot.m
Error in plotting (line 4)
plot(x,y);

2 件のコメント

dpb
dpb 2020 年 12 月 23 日
You named your script plot too, it seems.
Rename it to something not the same as a MATLAB function and try again.
Image Analyst
Image Analyst 2020 年 12 月 23 日
dpb - Post down in Answers so you can get credit for it. Mathworks rewards those who help.

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

回答 (2 件)

Alan Stevens
Alan Stevens 2020 年 12 月 23 日

0 投票

It works for me exactly as you have written it, with no error messages!
Walter Roberson
Walter Roberson 2020 年 12 月 23 日

0 投票

You created your own C:\Users\lenovo\Documents\MATLAB\plot.m that is interfering with using the MATLAB plot() function. You need to either rename or delete C:\Users\lenovo\Documents\MATLAB\plot.m

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

質問済み:

2020 年 12 月 23 日

コメント済み:

2020 年 12 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by