Why the given code is not running
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
function pdex4
m = 0;
x = [0 0.005 0.01 0.05 0.1 0.2 0.5 0.7 0.9 0.95 0.99 0.995 1];
t = [0 0.005 0.01 0.05 0.1 0.5 1 1.5 2];
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
% --------------------------------------------------------------
function [c,f,s] = pdex4pde(x,t,u,DuDx)
c = [1; 1];
f = [0.024; 0.17] .* DuDx;
y = u(1) - u(2);
F = exp(5.73*y)-exp(-11.47*y);
s = [-F; F];
end
% --------------------------------------------------------------
function u0 = pdex4ic(x);
u0 = [1; 0];
end
% --------------------------------------------------------------
function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t)
pl = [0; ul(2)];
ql = [1; 0];
pr = [ur(1)-1; 0];
qr = [0; 1];
end
% figure
surf(x,t,u1)
title('u1(x,t)')
xlabel('Distance x')
ylabel('Time t')
% figure
% surf(x,t,u2)
% title('u2(x,t)')
% xlabel('Distance x')
% ylabel('Time t')
end
採用された回答
madhan ravi
2018 年 9 月 9 日
編集済み: madhan ravi
2018 年 9 月 9 日
It’s working for me . Make sure you have partial differential equations toolbox by typing ver in your command window.
19 件のコメント
MINATI
2018 年 9 月 9 日
Thanks Madhan for your quick response By running the code the following Error shows Attempt to execute SCRIPT pdepe as a function: C:\Users\HP\pdepe.m
Error in pdex4 (line 11) sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
madhan ravi
2018 年 9 月 9 日
編集済み: madhan ravi
2018 年 9 月 9 日
change your function filename as pdex4.m

madhan ravi
2018 年 9 月 9 日
If it’s according to your wish and working please accept the answer.
madhan ravi
2018 年 9 月 9 日
編集済み: madhan ravi
2018 年 9 月 9 日
Haven’t heard from you in a while @Pattnaik. If something is not clear let know.
MINATI
2018 年 9 月 10 日
Dear Madhan Sorry for being late but file name is already given as yours. Can you do a favour by sending the modified code at minatipatra456@gmail.com
Thanks
madhan ravi
2018 年 9 月 10 日
check your mail
MINATI
2018 年 9 月 11 日
your code is running after download and putting RUN option but in my laptop in the following error occurs
Attempt to execute SCRIPT pdepe as a function: C:\Users\HP\pdepe.m
Error in pdex4 (line 7) sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
What to do
madhan ravi
2018 年 9 月 11 日
編集済み: madhan ravi
2018 年 9 月 11 日
Do you have partial differential equations toolbox? You should have one if you want to get the output. You can check it by typing ver in your command window.
MINATI
2018 年 9 月 11 日
yes the version is present
madhan ravi
2018 年 9 月 11 日
編集済み: madhan ravi
2018 年 9 月 11 日
Just download the attached file,
1)Press the green button in the script file OR
2)Type pdex4 in the command window.
madhan ravi
2018 年 9 月 13 日
Did you try what I said?
MINATI
2018 年 9 月 13 日
Yes I hv tried but again the following error comes Attempt to execute SCRIPT pdepe as a function: C:\Users\HP\pdepe.m
Error in pdex4 (line 7) sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
I think something wrong is happened with my software but other codes are running smoothly
MINATI
2018 年 9 月 13 日
Thanks Dear Madhan for your patience. Another thing are you OK with Matlab code to solve COUPLED PDE with TWO variables (y & t ) by using LAPLACE TRANSFORM. I need your help Please reply me on minatipatra456@gmail.com
madhan ravi
2018 年 9 月 13 日
編集済み: madhan ravi
2018 年 9 月 13 日
Please accept my answer if it solved your problem.
Walter Roberson
2018 年 9 月 13 日
You need to rename HP\pdepe.m as it is interfering with MATLAB routine of the same name.
madhan ravi
2018 年 9 月 13 日
編集済み: madhan ravi
2018 年 9 月 13 日
@PRADYUMNA I have no experience with solving PDE
MINATI
2018 年 9 月 13 日
Hi Walter following error occurs Error using pdepe Too many input arguments.
Error in pdepe (line 6) sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
Walter Roberson
2018 年 9 月 13 日
Which MATLAB version are you using? And what shows up for
which pdepe
MINATI
2018 年 12 月 28 日
C:\Users\HP\pdepe.m
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で PDE Solvers についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
