How do I solve Error using linspace Too many input arguments.

조회 수: 5 (최근 30일)
Madao Desu
Madao Desu 2019년 12월 23일
편집: Uerm 2020년 1월 5일
when I use this code I get this error, how do I solve this problem ?
because of this I'm unable to use linspace in plotting, help would be appreciated.
>> x=(2*pi:1000);
y=sin(x);
z = cos(x);
plot(x,y,x,z)
xlabel( 'Time ' ), ylabel(' Amplitude ' ), title(' Continuous Waves ' )
legend(' Sine Wave ' , ' Cosine Wave ')
grid
>> x=linspace(0,2*pi,1000);
y=sin(x);
z = cos(x);
plot(x,y,x,z)
xlabel( 'Time ' ), ylabel(' Amplitude ' ), title(' Continuous Waves ' )
legend(' Sine Wave ' , ' Cosine Wave ')
grid
Error using linspace
Too many input arguments.
  댓글 수: 2
Aquatris
Aquatris 2019년 12월 23일
You might have a custom linspace function in your directory. So when you call the linspace function, it does not call the built-in one.
Steven Lord
Steven Lord 2019년 12월 23일
To check what Aquatris hypothesizes, run this command and show us what it displays.
which -all linspace

댓글을 달려면 로그인하십시오.

채택된 답변

Uerm
Uerm 2019년 12월 23일
Hi,
I just tried to write your code and it seems to work for me... Try to clear all variables in Workspace and run the code again. I don't see any reason why it should not work.
  댓글 수: 2
Madao Desu
Madao Desu 2019년 12월 23일
I did clear everything and double checked a lot of times, still the same problem, I don't know what's wrong, linspace is not working for me at all even something like this a = linspace(0,10,5) is not working.
Uerm
Uerm 2020년 1월 5일
편집: Uerm 2020년 1월 5일
Have you tried the solutions above mentioned by Aquatris and Steven?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by