Function solving for y
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
k=ones(4,1);
y=fsolve(cdepth,k);
function N=cdepth(Rh,theta1,y,Ax)
D=1.2; %diameter of tube in m made of smooth plastic
z=4; %elevation change of 4 m per section
L=[6 8 10 5]; %length if each section of the spiral slide
n=.01; %assumed
slope=atan(L./(pi.*D))./100; %slopes of each section of the pipes
Q3=9.921896118095368;
theta1(1)=2.*acos(1-(2.*y(1)./D));
theta1(2)=2.*acos(1-(2.*y(2)./D));
theta1(3)=2.*acos(1-(2.*y(3)./D));
theta1(4)=2.*acos(1-(2.*y(4)./D));
Ax(1)=(1/8)*(theta1(1)-sin(theta1(1))).*D.^2;
Ax(2)=(1/8)*(theta1(2)-sin(theta1(2))).*D.^2;
Ax(3)=(1/8)*(theta1(3)-sin(theta1(3))).*D.^2;
Ax(4)=(1/8)*(theta1(4)-sin(theta1(4))).*D.^2;
Rh(1)=.25.*(1-sin(theta1(1))./theta1(1)).*D;
Rh(2)=.25.*(1-sin(theta1(2))./theta1(2)).*D;
Rh(3)=.25.*(1-sin(theta1(3))./theta1(3)).*D;
Rh(4)=.25.*(1-sin(theta1(4))./theta1(4)).*D;
N(1)=((1./n).*Ax(1).*(Rh(1)).^(2/3).*slope(1).^.5)-Q3;
N(2)=((1./n).*Ax(2).*(Rh(2)).^(2/3).*slope(2).^.5)-Q3;
N(3)=((1./n).*Ax(3).*(Rh(3)).^(2/3).*slope(3).^.5)-Q3;
N(4)=((1./n).*Ax(4).*(Rh(4)).^(2/3).*slope(4).^.5)-Q3;
end
when I try to run my function I get this error code and I'm not sure why. Can anyone help?
Not enough input arguments.
Error in Final_Vogt_RV>cdepth (line 511)
theta1(1)=2.*acos(1-(2.*y(1)./D));
Error in Final_Vogt_RV (line 501)
y=fsolve(cdepth,k);
3 Commenti
Stephen23
il 15 Dic 2020
Modificato: Stephen23
il 15 Dic 2020
k=ones(4,1);
y=fsolve(cdepth,k);
function N=cdepth(Rh,theta1,y,Ax)
D=1.2; %diameter of tube in m made of smooth plastic
z=4; %elevation change of 4 m per section
L=[6 8 10 5]; %length if each section of the spiral slide
n=.01; %assumed
slope=atan(L./(pi.*D))./100; %slopes of each section of the pipes
Q3=9.921896118095368;
theta1(1)=2.*acos(1-(2.*y(1)./D));
theta1(2)=2.*acos(1-(2.*y(2)./D));
theta1(3)=2.*acos(1-(2.*y(3)./D));
theta1(4)=2.*acos(1-(2.*y(4)./D));
Ax(1)=(1/8)*(theta1(1)-sin(theta1(1))).*D.^2;
Ax(2)=(1/8)*(theta1(2)-sin(theta1(2))).*D.^2;
Ax(3)=(1/8)*(theta1(3)-sin(theta1(3))).*D.^2;
Ax(4)=(1/8)*(theta1(4)-sin(theta1(4))).*D.^2;
Rh(1)=.25.*(1-sin(theta1(1))./theta1(1)).*D;
Rh(2)=.25.*(1-sin(theta1(2))./theta1(2)).*D;
Rh(3)=.25.*(1-sin(theta1(3))./theta1(3)).*D;
Rh(4)=.25.*(1-sin(theta1(4))./theta1(4)).*D;
N(1)=((1./n).*Ax(1).*(Rh(1)).^(2/3).*slope(1).^.5)-Q3;
N(2)=((1./n).*Ax(2).*(Rh(2)).^(2/3).*slope(2).^.5)-Q3;
N(3)=((1./n).*Ax(3).*(Rh(3)).^(2/3).*slope(3).^.5)-Q3;
N(4)=((1./n).*Ax(4).*(Rh(4)).^(2/3).*slope(4).^.5)-Q3;
end
when I try to run my function I get this error code and I'm not sure why. Can anyone help?
Not enough input arguments.
Error in Final_Vogt_RV>cdepth (line 511)
theta1(1)=2.*acos(1-(2.*y(1)./D));
Error in Final_Vogt_RV (line 501)
y=fsolve(cdepth,k);
Risposte (1)
Star Strider
il 12 Dic 2020
After making sure that all the arguments are present in your workspace, try this:
y=fsolve(@(y)cdepth(Rh,theta1,y,Ax),k);
That’s the correct syntax. If your function is correct, you should get the correct result.
0 Commenti
Vedere anche
Categorie
Scopri di più su Polymers in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!