I write three functions, and one of them use the other two. When I run 'curve_p_16_1_1' and 'curve_p_16_1_2' alone, they work fine. However, when I run 'curve_p_16_1', it says 'Not enough input arguments.'. Could anyone help me to figure out the problem?
function p = curve_p_16_1_1(t) %curve function of example 16, NACA 0012
%inner air foil, upper part
%INPUT:
%t: parameter, [0,1], counterclockwise
%OUTPUT:
%p: [x y], point coordinate on curve
%x = sqrt(X) to avoid singularity at xmin
xmin = 0;xmax = sqrt(1.008930411365);y = @(x) 0.6*(0.2969*x-0.1260*x^2-0.3516*x^4+0.2843*x^6-0.1015*x^8);syms sdy = matlabFunction(diff(0.6*(0.2969*s-0.1260*s^2 ... -0.3516*s^4+0.2843*s^6-0.1015*s^8),s));f = @(x) sqrt(1+dy(x).^2);l = integral(f,xmin,xmax); %total curve length
g = @(x) integral(f,xmin,x)-(1-t)*l;x = fzero(g,[xmin xmax]);p = [x^2 y(x)];function p = curve_p_16_1_2(t)%curve function of example 16, NACA 0012%inner air foil, lower part
%INPUT:%t: parameter, [0,1], counterclockwise%OUTPUT:%p: [x y], point coordinate on curve%x = sqrt(X) to avoid singularity at xminxmin = 0;xmax = sqrt(1.008930411365);y = @(x) -0.6*(0.2969*x-0.1260*x^2-0.3516*x^4+0.2843*x^6-0.1015*x^8);syms sdy = matlabFunction(diff(0.6*(0.2969*s-0.1260*s^2 ... -0.3516*s^4+0.2843*s^6-0.1015*s^8),s));f = @(x) sqrt(1+dy(x).^2);l = integral(f,xmin,xmax); %total curve lengthg = @(x) integral(f,xmin,x)-t*l;x = fzero(g,[xmin xmax]);p = [x^2 y(x)];function p = curve_p_16_1(T)n = 2; %number of curves
for i = 1:n if T >= (i-1)/n && T <= i/n t = T*n-(i-1); str = ['@(t) curve_p_16_1_' num2str(i)]; f = str2func(str); p = f(t); endend>> curve_p_16_1(0)Not enough input arguments.Error in curve_p_16_1_1 (line 18)g = @(x) integral(f,xmin,x)-(1-t)*l;Error in curve_p_16_1>@(t)curve_p_16_1_1Error in curve_p_16_1 (line 9) p = f(t);
Best Answer