how do i solve this equation using matlab

조회 수: 6 (최근 30일)
Anthony Irvine
Anthony Irvine 2023년 3월 4일
댓글: Rik 2023년 3월 9일
T(x,y,z,t)=\frac{2\times A\times P_\max\times\sqrt\alpha}{k\times\pi^\frac{2}{3}\times r^2}\int_0^{\sqrt t}\times\frac{1}{1+\frac{4\times\alpha\times u^2}{r^2}} \times\exp (\frac{-x^2-y^2}{r^2+4\times\alpha\times u^2}-\frac{z^2}{4\times\alpha\times u})du
ive created my equation using latex but i am not sure how to write a script to solve for T and plot a temperature time graph. some guidance would be appreciated.
  댓글 수: 3
John D'Errico
John D'Errico 2023년 3월 4일
It seems to have some errors in it. At least LaTeX did not seem to like what it saw on my computer. It is difficult to write MATLAB code for something if you cannot even show the problem you want to solve.
So if you want help, then you need to make it possible to help you.
Rik
Rik 2023년 3월 9일
I recovered the removed content from the Google cache (something which anyone can do). Editing away your question is very rude. Someone spent time reading your question, understanding your issue, figuring out the solution, and writing an answer. Now you repay that kindness by ensuring that the next person with a similar question can't benefit from this answer.

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

답변 (1개)

Torsten
Torsten 2023년 3월 4일
이동: Torsten 2023년 3월 4일
T = @(x,y,z,t) 2*A*P_max*sqrt(alpha)/(k*pi^(2/3)*r^2)*integral(@(u)1./(1+4*alpha*u.^2/r^2).*exp(-(x^2+y^2)./(r^2+4*alpha*u.^2)-z^2./(4*alpha*u),0,sqrt(t))
  댓글 수: 7
Torsten
Torsten 2023년 3월 4일
tic
x=1;
y=1;
z=1;
A = 1;
P_max = 1;
r = 1;
k = 1;
alpha = 1;
T = @(x,y,z,t) 2*A*P_max*sqrt(alpha)/(k*pi^(2/3)*r^2)*integral(@(u)1./(1+4*alpha*u.^2/r^2).*exp(-(x^2+y^2)./(r^2+4*alpha*u.^2)-z^2./(4*alpha*u)),0,sqrt(t))
T = function_handle with value:
@(x,y,z,t)2*A*P_max*sqrt(alpha)/(k*pi^(2/3)*r^2)*integral(@(u)1./(1+4*alpha*u.^2/r^2).*exp(-(x^2+y^2)./(r^2+4*alpha*u.^2)-z^2./(4*alpha*u)),0,sqrt(t))
t_upper = 3;
t = linspace(0, t_upper, 250);
T_num = arrayfun(@(t) T(x,y,z,t),t)
T_num = 1×250
0 0.0004 0.0013 0.0024 0.0037 0.0050 0.0063 0.0077 0.0091 0.0105 0.0118 0.0132 0.0146 0.0160 0.0173 0.0186 0.0200 0.0213 0.0226 0.0239 0.0251 0.0264 0.0276 0.0289 0.0301 0.0313 0.0325 0.0336 0.0348 0.0359
plot(t,T_num)
toc
Elapsed time is 0.492061 seconds.
Torsten
Torsten 2023년 3월 4일
how can i change the integration limits so that it could be sqrt ( time minus a constant)
By defining the constant before defining the function handle T and changing "sqrt(t)" in the definition of T to whatever you like as upper limit of integration.

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by