erorr in MATLAB programming
3 views (last 30 days)
Show older comments
hello
Why does the following program give an error?
function pdex4
m=0;
x=linspace(0,0.3,50);
t=linspace(0,50);
sol=pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
u1=sol(:,:,1);
u2=sol(:,:,2);
figure
surf(x,t,u1)
title('u1(x,t)')
xlable('Distance x')
ylable('Time t')
figure
surf(x,t,u2)
title('u2(x,t)')
xlable('Distance x')
ylable('Time t')
function [c,f,s]=pdex4pde(x,t,u,DuDx)
c=[1;0];
w=10;
v=0.9979;
a0=5;
f=[1;1].* DuDx;
F1=u(1).*((w)^2-(((v^2)/(((1+a0^2)^0.5+u(2))-(1-v^2).*(1+u(1).^2))).^0.5)/(1-v^2));
F2=-(((((v^2)/(((1+a0^2)^0.5+u(2))-(1-v^2).*(1+u(1).^2))).^0.5)).*((1+a0^2)^0.5+u(2))-1)/(1-v^2);
s=[F1,F2];
function u0=pdex4ic(x)
u0=[10;0];
function [pl,ql,pr,qr]=pdex4bc(xl,ul,xr,ur,t)
pl=[0;u1(2)];
ql=[1,0];
pr=[ur(1)-1;0];
qr=[0;1];
3 Comments
Steven Lord
on 18 Sep 2020
Yes, please show the full and exact text of the error message (all the text displayed in red in the Command Window.) If there are any warning messages displayed in orange please include the full and exact text of those messages as well (indicating which are warnings and which are errors if it's not obvious.)
Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!