Ode Not enough input arguments.

6 views (last 30 days)
EldaEbrithil
EldaEbrithil on 7 Oct 2020
Commented: EldaEbrithil on 7 Oct 2020
Hi all
i have this code
clear all;
close all;
clc;
xstartconica=9.923425547086419e-04;
xfineconica=0.006023740592755;
Ralfa_end=0.030973382509232;
Rbeta_end=0.005317248451592;
alfa_end_rad=0.191986217719376;
beta_end_rad=0.645771823237902;
xc_end=0.004812528236661;
yc_end=0.007521773875673;
Lnozzle_end=0.029788357160958;
raggio_end=0.006347773875673;
Nn=10^-5;
f3_variation=4e-3:2e-4:5e-3;
f2_variation=1e-1:2e-2:5e-1;
f1_variation=1e-1:1e-2:5e-1;
Ptend_conv=[147245.424239257,147234.962409348,147224.499805318,147214.036426991,147203.572274194,147193.107346753,147182.641644491,147172.175167235,147161.707914810,147151.239887040,147140.771083752,147130.301504769,147119.831149918,147109.360019022,147098.888111906,147088.415428396,147077.941968316,147067.467731491,147056.992717745,147046.516926902,147036.040358788,147025.563013225,147015.084890040,147004.605989055,146994.126310095,146983.645852985,146973.164617547,146962.682603606,146952.199810987,146941.716239512,146931.231889005,146920.746759291,146910.260850192,146899.774161532,146889.286693136,146878.798444825,146868.309416424,146857.819607755,146847.329018643,146836.837648909,146826.345498378];
Mend_conv=[0.140750461243504,0.140760731075046,0.140771003185311,0.140781277575151,0.140791554245414,0.140801833196952,0.140812114430615,0.140822397947255,0.140832683747724,0.140842971832875,0.140853262203559,0.140863554860630,0.140873849804943,0.140884147037350,0.140894446558707,0.140904748369869,0.140915052471691,0.140925358865029,0.140935667550740,0.140945978529680,0.140956291802707,0.140966607370678,0.140976925234451,0.140987245394886,0.140997567852842,0.141007892609177,0.141018219664752,0.141028549020427,0.141038880677064,0.141049214635523,0.141059550896667,0.141069889461358,0.141080230330458,0.141090573504830,0.141100918985339,0.141111266772849,0.141121616868223,0.141131969272327,0.141142323986026,0.141152681010187,0.141163040345676];
for m=1:41
for f_d=1:length(f2_variation)
Ynozzle02(m)={[Ptend_conv(m),Mend_conv(m)]};
Dall_nozzle2 ={[xstartconica:Nn:xfineconica]};
f2_cell(f_d)={f2_variation(f_d)};
end
end
opt=odeset('NormControl','Refine','Stats','MaxStep');
for iDom_nozzle2 = 1:numel(Dall_nozzle2)
xRangenozzle2 = Dall_nozzle2{iDom_nozzle2};
for iInitial_nozzle2 = 1:numel(Ynozzle02)
for fF_2=1:numel(f2_cell)
f2= f2_cell{fF_2};
[xSolnozzle2{iDom_nozzle2,iInitial_nozzle2,fF_2},YSolnozzle2{iDom_nozzle2,iInitial_nozzle2,fF_2}]=ode23(@(x,Ynozzle)nozzlesinglebobbgola(x,Ynozzle, ...
xstartconica,xfineconica,Ralfa_end,Rbeta_end,alfa_end_rad,beta_end_rad,xc_end,yc_end,Lnozzle_end,raggio_end,f2),xRangenozzle2,Ynozzle02{iInitial_nozzle2},...
opt);
end
end
end
related to this function
function dYnozzledx=nozzlesinglebobbgola(x,Ynozzle,xstartconica,xfineconica,Ralfa_end,Rbeta_end,alfa_end_rad,beta_end_rad,xc_end,yc_end,Lnozzle_end,raggio_end,f3,f2,f1)
gamma=1.667;
Pt_nozzle=Ynozzle(1);
M_nozzle=Ynozzle(2);
Anozzle= pi*(yc_end-sqrt(raggio_end^2-(x-xc_end)^2))^2;
Perimetro= 2*pi*(yc_end-sqrt(raggio_end^2-(x-xc_end)^2));
dA_nozzledx=(2*pi*(x-xc_end)/(sqrt(raggio_end^2-(x-xc_end)^2)))*(yc_end-sqrt(raggio_end^2-(x-xc_end)^2));
dPt_nozzledx=-Pt_nozzle*((gamma*(M_nozzle^2))/2)*f2*(Perimetro/Anozzle);
dM_nozzledx=M_nozzle*((-(1+((gamma-1)/2)*M_nozzle^2)/(1-M_nozzle^2))*(dA_nozzledx/Anozzle)+...
((1+((gamma-1)/2)*M_nozzle^2)/(1-M_nozzle^2))*(gamma*(M_nozzle^2)*f2*Perimetro/(2*Anozzle)));
dYnozzledx=[dPt_nozzledx;dM_nozzledx];
end
i don't know why i obtain the error:Not enough input arguments...Any help?
Thank you very much
Regards
  2 Comments
Stephen23
Stephen23 on 7 Oct 2020
Edited: Stephen23 on 7 Oct 2020
Those function calls would be much simpler if you just put all of the parameters into a scalar structure and passed that. That number of positional input arguments makes it highly likely that you mave missed one or two, or got them in the wrong order.
In any case, please show us the exact error message. This means all of the red text.
EldaEbrithil
EldaEbrithil on 7 Oct 2020
yes of course, i have extrapolated that code from an implicit, simpler but bigger one.. i think that the error is related with the ode call but i am not sure about that

Sign in to comment.

Accepted Answer

Stephen23
Stephen23 on 7 Oct 2020
Edited: Stephen23 on 7 Oct 2020
As the error states, you are not calling the function nozzlesinglebobbgola with enough input arguments:
nozzlesinglebobbgola(x, Ynozzle, xstartconica,xfineconica,Ralfa_end,Rbeta_end,alfa_end_rad,beta_end_rad,xc_end,yc_end,Lnozzle_end,raggio_end,f2) % how you call it
nozzlesinglebobbgola(x, Ynozzle, xstartconica,xfineconica,Ralfa_end,Rbeta_end,alfa_end_rad,beta_end_rad,xc_end,yc_end,Lnozzle_end,raggio_end,f3,f2,f1) % how you defined it
Or with the intermediate variables removed for clarity:
nozzlesinglebobbgola(x, Ynozzle, .. ,raggio_end,f2) % how you call it
nozzlesinglebobbgola(x, Ynozzle, .. ,raggio_end,f3,f2,f1) % how you defined it
Using so many positional input arguments is buggy (e.g. like this question) and makes the code very difficult to understand. Avoid doing this. I strongly recommend that you do either of these:
  1. put all of those parameters into one scalar structure and pass that.
  2. use a nested function, then you don't need those input arguments at all (nor the anonymous function).
  1 Comment
EldaEbrithil
EldaEbrithil on 7 Oct 2020
thank you very much Stephen, it was a positioning error...sorry for wasting your time
Regards

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!