Not enough input arguments "Error using Cos"

조회 수: 1 (최근 30일)
Praveen Kumar Pakkirisamy
Praveen Kumar Pakkirisamy 2020년 2월 12일
댓글: Praveen Kumar Pakkirisamy 2020년 2월 12일
I am trying to build a matrix A which has the following cos and sin components, However when I try to put them together, I get the error of "Not enough input arguments". When I copied a single line and executed, I got the answer, I don't know why this is not working when I run everything together.
%% Test
phi_r = 0;
phi = pi/2;
alpha = 0.35;
omega = 1;
% Initial step (Matrices)
A = [ 0 ,0 ,0 ,0;...
v_phi .* cos(phi_r) .* cos (phi),-v_phi .* cos(phi_r) .* cos (phi), 1, -v_phi./alpha.* sin(phi_r).*cos(phi);...
v_omega * cos(phi_r) .* cos (phi), -v_omega .* cos(phi_r) .* cos (phi),0,-v_omega/alpha.* sin(phi_r).*cos(phi);
eta.*alpha.*cos(phi_r).*sin(phi),-eta.*alpha.*cos(phi_r).*sin(phi),0,-eta.*sin(phi_r).*sin(phi)];

채택된 답변

Walter Roberson
Walter Roberson 2020년 2월 12일
No space between cos and (
You are inside a list building operation. Spaces can indicate that an entry has ended and a new one is about to begin. MATLAB does not determine a new entry to start if the previous entry ends in one of the binary operators
3+ 5 %all one expression
3 + 5 %all one expression
3 +5 %two expressions, 3 and +5
cos is not a binary operation, so
3 + cos (x)
is two entries, 3+cos and (x). In turn 3+cos is 3+cos() which is the function invoked with no arguments.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by