CAT arguments dimensions are not consistent Error in Solving ode45 ?
4 ビュー (過去 30 日間)
古いコメントを表示
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))
0 件のコメント
採用された回答
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
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!