Not enough input arguments "Error using Cos"

1 次查看(过去 30 天)
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 中查找有关 Get Started with MATLAB 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by