Error using PDEPE Function (Column Vector Mismatch)
3 ビュー (過去 30 日間)
古いコメントを表示
This is the error I get:
Unexpected output of PDEFUN. For this problem PDEFUN must return three column vectors of length 2.
My PDE function is as follows:
function [c,f,s] = modelPDE(x,t,u,DuDx)
% u(1) is eta, u(2) is kappa_f
global eps xst Ys fst fsh fab
%%Equation of the substrate and its gradients
if x < xst
s_x = fst*0.5*Ys*sin(fst*x);
s_xx = (fst^2)*0.5*Ys*cos(fst*x);
s_xxx = -(fst^3)*0.5*Ys*sin(fst*x);
s_xxxx = -(fst^4)*0.5*Ys*cos(fst*x);
else
s_x = -fsh*0.5*Ys*sin(fsh*x-fab);
s_xx = -(fsh^2)*0.5*Ys*cos(fsh*x-fab);
s_xxx = (fsh^3)*0.5*Ys*sin(fsh*x-fab);
s_xxxx = (fsh^4)*0.5*Ys*cos(fsh*x-fab);
end
%%Curvature and its gradients
ms = sqrt(1 + (s_x.^2));
Ks = - s_xx./(ms.^3);
ms_x = s_x.*s_xx./ms;
ms_xx = s_x.*s_xxx./ms + s_xx.*Ks;
Ks_x = (3*ms_x.*s_xx./ms - s_xxx)./(ms.^3);
Ks_xx = (3*(ms_x.*s_xxx./ms + (ms_xx./ms - (ms_x./ms).^2).*s_xx) - ...
s_xxxx)./(ms.^3) - 3*ms_x.*Ks_x./ms;
beta = eps*Ks.*Ks_x./(2*ms);
beta_x = 0.5*eps*(Ks.*Ks_xx + (Ks_x.^2) - ms_x.*Ks.*Ks_x./ms)./ms;
Ksq = Ks.^2;
%%Coefficients and Source Terms
phi = 1 - eps*Ks.*u(1);
s1 = (beta_x.*u(1) + 4*beta.*DuDx(1)).*(u(1).^3);
s2 = ms.*((u(2)-Ks)/eps - Ksq.*u(1));
f1 = - (u(1).^3).*DuDx(2)./ms;
f2 = - DuDx(1)./ms;
c1 = ms.*phi;
c2 = 0;
%%Deliverables
c = [c1; c2];
f = [f1; f2];
s = [s1; s2];
end
Maybe the error is the way I am using the variable "x", but I am not sure. Any help will be appreciated.
0 件のコメント
回答 (1 件)
Torsten
2017 年 7 月 17 日
編集済み: Torsten
2017 年 7 月 17 日
Check the size of c,f and s:
https://de.mathworks.com/help/matlab/ref/size.html
If they don't have dimension (2x1) each, something went wrong.
Best wishes
Torsten.
1 件のコメント
FATUMAH ATUHAIRE
2017 年 11 月 25 日
I have the same problem. I realised the size of f changes to a 21 by 1 matrix, yet what I write in the code is a 6 by 1. And c and s are 6 by 1 matrices. How can I rectify this? Thanks.
参考
カテゴリ
Help Center および File Exchange で General PDEs についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!