Why does this keep giving me the error "Not enough input arguments"
이전 댓글 표시
I'm a beginner at MatLab so sorry for asking this very 'noobish' question. I'm basically trying to plot the following function, f(x) = cos(x) * sin(x)
In my "main" matlab file, I have the following code:
x = 0:pi/1000:2*pi;
third = ThirdFunction(x);
plot(x,third,'y');
axis([0 2*pi -3 3])
xlabel('X - Axis')
ylabel('Y - Axis')
title('Sinusodial Graph')
This is the code for my ThirdFunction
function [y] = ThirdFunction(x)
%FIRSTFUNCTION Summary of this function goes here
% Used to graph the first function
y = tan(x) * sin(x);
end
Everytime I try to compile, it gives me the following error: 'Error using ThirdFunction (line 4) Not enough input arguments."
Thanks in advance :)
댓글 수: 2
Star Strider
2014년 9월 27일
I ran it in a nested function and it ran without error once I used element-wise multiplication here:
y = tan(x) .* sin(x);
What specifically is ‘line 4’?
Adam
2014년 9월 27일
Do you really want to plot in yellow by the way?! You'll hardly see it on a white background!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Surfaces, Volumes, and Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!