MATLAB: Unable to use function in script

callingfunctionmultiple output function

I am new to matlab, i created a function file and it is working fine while using in command winow but showing "Not enough input arguments." while using in a script
function [V,A,Up,dV,dA] = VAUt(ct,B,L,r,R,Ach,Ap,N)
B = B*0.0254;
L = L*0.0254;
Ach = Ach*0.00064516;
Ap = Ap*0.00064516;
Vd = 22*(B^2)*L/28;
Vc = Vd/(r-1);
V = Vc*(1+0.5*(r-1)*(R+(1- cosd(ct))-((R^2)-((sind(ct))^2))^0.5));
A = Ach + Ap + 22*B*L*(R+1-cosd(ct)+((R^2)-(sind(ct))^2))/14;
Up = 22*L*N*sind(ct)*(cosd(ct)/(((R^2)-(sind(ct))^2)^0.5)+1)/7;
dV = Vc*(R/2 – cos((pi*ct)/180)/2 – (R^2 – sin((pi*ct)/180)^2)^(1/2)/2 + 1/2);
dA = (11*B*L*((pi*sin((pi*ct)/180))/180 – (pi*cos((pi*ct)/180)*sin((pi*ct)/180))/90))/7;
end
in = [15,14,14,9,6,231,154,1500];
[Vt,At,Upt,dVt,dAt] = VAUt(in);
A = [Vt,At,Upt,dVt,dAt];
for i = 0:1:36
in(1) = i*5;
A(:,:,i) = VAUt(in);
end

Best Answer

Hi,
you define an array as input arguments. Matlab interprets your array as one input argument, not as 8 as you think. This is because Matlab accepts vectorized functions, which would accept vectors of every single input argument and would calculate the function for all of them with as many function results as the vector has elements. This saves time and no for loops are needed. But the other side is, that you can not give multiple input arguments the way you do.
Best regards
Stephan