Error using pdepe function in matlab.
11 次查看(过去 30 天)
显示 更早的评论
The code runs well with M as a numeric but when I change it to a range of values, it gives me a error. How can I rectify this?
0 个评论
回答(1 个)
Torsten
2018-2-9
Call pdepe in a loop for M = M_array(1),M = M_array(2),...
Best wishes
Torsten.
10 个评论
Walter Roberson
2018-2-20
Torsten had suggested
z1 = heaviside(M-Me);
z2 = heaviside(M-Ms);
z3 = heaviside(eta-u(3));
where M was the interpolated value based upon x. You replaced the heaviside with calls to Untitl that reads the entire .cvs file and uses all of it instead of using the interpolated value -- and without even differentiating between the two columns of the file at that.
Do not read the entire file there. Pass in the current M value to your Untitl function and use that.
I notice, by the way, that your heav function calculates a constant eta and compares that to the input parameter, and that your weakly-named Untitl just does comparisons, acting as a heaviside function. I would suggest to you that it would make more sense to have a function that calculated eta once and return that, and then to have a heaviside function that did nothing but heaviside, and pass in the appropriate difference between eta and whatever. Or don't bother with an explicit heaviside and instead code
z1 = M > Me;
z2 = M > Ms;
z3 = eta() > u(3);
where
function eta_val = eta()
phi =100;
lambdaphi = 4.9*10^(-3);
phic = 60;
lambda0 = 10* lambdaphi.*phi;
eta_val = (lambdaphi/lambda0)*phic;
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!