CAT arguments dimensions are not consistent Error in Solving ode45 ?

조회 수: 4 (최근 30일)
AK Khan
AK Khan 2015년 5월 6일
댓글: AK Khan 2015년 5월 7일
I am getting the CAT argument dimensions error in computing two differential equations using ODE45. Apparently everything seems right and the vector I used seem to have same dimentions. The code is Give below.
% The memcapfinal.m includes the follwing code.
function qprime=memcapfinal(t,q);
e = 1.6*10^(-19); %C electron charge%
h = 6.63*10^(-34); %J/s planks constant%
phi = (0.3)*1.6*10^(-19); %J barrier height%
R=1;
Epsilon0 = 8.85*10^-12;
k1 = 100;
k2 = 10;
d=10*10^(-9);
s = 6*10^(-9);
m = 9.11*10^(-31); %kg electron mass%
A = 10^(-4);
b = -4*3.14*s/h;
c0=(A*Epsilon0*k1)/d;
t1=0:0.0000001:0.0005;
f=10000;
v0=7.5;
T=5/f;
v=v0*sin(2*3.14*f*t1);
plot(t1,v);
qprime=[((v/R)-(1/R)*(((d*q(1))+(s*q(2)))/(c0*d)));(sqrt(2*m*phi)/s*(e/h)^2*(((q(1)+q(2))/(2*A*Epsilon0*k2))*s)*exp(b*sqrt(2*m*phi)))*A];
And the code which calls the ODE is given below
clear all;
q0=[0 10^(-9)];
tspan1=[0,0.0005];
[t,q]=ode45(@memcapfinal,tspan1,q0)
subplot(2,1,1)
plot(t,q(:,1))
subplot(2,1,2)
plot(t,q(:,2))

채택된 답변

Walter Roberson
Walter Roberson 2015년 5월 6일
dbstop if caught error
then run the program. If it stops for any reason other than the cat problem, then use dbcont to keep going.
When it stops with the cat error, display
size( ((v/R)-(1/R)*(((d*q(1))+(s*q(2)))/(c0*d))) )
size( (sqrt(2*m*phi)/s*(e/h)^2*(((q(1)+q(2))/(2*A*Epsilon0*k2))*s)*exp(b*sqrt(2*m*phi)))*A )
As you do not appear to use t in your calculation, and as your code would error if q did not have at least 2 elements, I predict that the problem happens every time
  댓글 수: 10
AK Khan
AK Khan 2015년 5월 7일
@Walter Roberson, In the same code I need to plot q(1) vs v and q(2) vs v. The problem is that v is always returned as undefined function . The length of t is 133 and that of q(1) and q(2) is 1.. The point is how to plot q(1) vs v and q(2) vs v ?
AK Khan
AK Khan 2015년 5월 7일
I am so sorry for bothering you again.I am so new to this kinda stuff.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by