Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
my code has a problem. Could you help me please??

Subject: my code has a problem. Could you help me please??

From: kittipong tissayakorn

Date: 7 Oct, 2012 04:35:10

Message: 1 of 2

function [u1,x,t] = heat_exp(a,xf,T,it0,bx0,bxf,M,N)

%Parameter

% solve Du/Dt = a*Du/Dx
%
ky = 0.071709561;
fd = 0.005;
P = 0.01064222;
w2 = 2*ky*P/fd



a = 50
xf = 0.3;
M = 10;
T = 3600;
N = 60;

dx = xf/M;
dt = T/N;

x = [0:M]*dx;
 
t = [0:N]*dt;

it0 = (3*x)/a;

bx0 = 3*t;

bxf =0.9*t ;


for i = 1:M+1, u1(i,1) = it0(x(i));end
for n = 1:N+1, u1([1 M+1],n) = [bx0(t(n));bxf(t(n))];end
r = a*dt/dx, r1 = 1-2*r;

for k = 1:N
    for i = 2:M
        u1(i,k+1) = r*((u1(i+1,k)+u1(i-1,k))+u1(i-1,k))+ r1*u1(i,k);
    end
end
figure
surface(x,t,u)
title('X')

Subject: my code has a problem. Could you help me please??

From: Steven_Lord

Date: 9 Oct, 2012 15:16:59

Message: 2 of 2



"kittipong tissayakorn" <kirua_benz@hotmail.com> wrote in message
news:k4r0pu$f1g$1@newscl01ah.mathworks.com...

*snip lots of code*

What SPECIFICALLY is the problem? Does it warn, does it error, does it give
the wrong answer, does it shut down your computer?

How do you reproduce the problem (i.e. what EXACTLY do you provide for
inputs to the code to cause the problem to occur?)

Please post this information to the newsgroup; do NOT respond to me
directly.

*snip*

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us