Incorrect number of inputs or outputs for function linspace
이전 댓글 표시

댓글 수: 8
clc
clear
x=0:pi/100:2*pi;
y=sin(x);
z=linspace(1,100)
The default for linspace() is 100 points.
If your linspace() is complaining then somehow you are getting a different linspace. What shows up for
which -all linspace
Tanveer Islam
2023년 6월 5일
Tanveer Islam
2023년 6월 5일
Star Strider
2023년 6월 5일
It should be returning something similar to those in Walter’s Comment.
Run these from a script or your Command Window:
restoredefaultpath
rehash toolboxcache
Then try your original code again and report the results.
Torsten
2023년 6월 5일
for further context, I did cut and paste the r2023 version from the original c folder to g recently.
That's temerarious.
Walter Roberson
2023년 6월 5일
The MATLAB that you copied from C: to G: recently appears to not be complete. If you need it to be stored in G: drive you should remove the G: version and uninstall from C: and then use the installer to install into G: directly.
Tanveer Islam
2023년 6월 5일
Torsten
2023년 6월 5일
You should follow Walter's advice.
답변 (1개)
Even if it is a matter of personal taste, for unit steps I usually prefer to do:
z1 = 1 : 100;
Nontheless, this should also work:
z2 = linspace(1, 100);
isequal(z1, z2)
Are you sure didn't create a function called linspace?
Have you tried to reset the path and clear the Workspace?
Try to restart Matlab and run it again.
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

