Wrong sine plot when styling it
14 ビュー (過去 30 日間)
古いコメントを表示
I was playing with the tutorial of Matlab. I've written this code:
x = linspace(0, 2*pi);
y = sin(x);
plot(x, y)
And I obtain the right plot:
![right](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1689112/right.png)
But then I use the following command:
plot(x, y, "r--")
And I obtain this weird plot:
![wrong](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1689117/wrong.png)
What I'm doing wrong?
2 件のコメント
Steven Lord
2024 年 5 月 7 日
Let's check which plot function you're calling in each case.
x = linspace(0, 2*pi);
y = sin(x);
which plot(x, y)
which plot(x, y, "r--")
In particular, I'm wondering if something added an overload of plot for the string data type to the MATLAB path.
And just for completeness, what does the next line of code show and what is the output of the which call that follows it?
plot(x, y, 'r--')
which plot(x, y, 'r--')
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Specifying Target for Graphics Output についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!