Clear Filters
Clear Filters

Not enough input arguments "Error using Cos"

1 view (last 30 days)
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)];

Accepted Answer

Walter Roberson
Walter Roberson on 12 Feb 2020
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.

More Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!