Error using PDEPE Function (Column Vector Mismatch)

조회 수: 3 (최근 30일)
Shashank
Shashank 2017년 7월 17일
댓글: FATUMAH ATUHAIRE 2017년 11월 25일
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.

답변 (1개)

Torsten
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
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 CenterFile Exchange에서 Boundary Conditions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by