# how i can change the explicit code to implicit code?

2 visualizzazioni (ultimi 30 giorni)
fadhl annabi il 10 Mag 2019
Commentato: gonzalo Mier il 12 Mag 2019
hi ....i have wrriten explicit code in matlab but i wanna turn to implicit so i need help in this.
here's the explicit code
clc
clear all
c=490;
k=54;
p=7800;
dt=3;
dx=0.01;
alpha=k/(p*c);
lamda=alpha*dt/dx^2;
for n=1:4
T(n,1)=100;
T(n,6)=25;
end
for i=2:5
T(1,i)=20;
end
for n=1:3
for i=2:5
T(n+1,i)=lamda*(T(n,i-1)-2*T(n,i)+T(n,i+1))+T(n,i)
end
end
for i=1:6
x(i)=(i-1)*0.01;
end
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

gonzalo Mier il 10 Mag 2019
function [T,x] = example(c,k,p,dt,dx)
alpha=k/(p*c);
lamda=alpha*dt/dx^2;
for n=1:4
T(n,1)=100;
T(n,6)=25;
end
for i=2:5
T(1,i)=20;
end
for n=1:3
for i=2:5
T(n+1,i)=lamda*(T(n,i-1)-2*T(n,i)+T(n,i+1))+T(n,i)
end
end
for i=1:6
x(i)=(i-1)*0.01;
end
end
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
gonzalo Mier il 12 Mag 2019
Accept the answer if it worked for you! :)

Accedi per commentare.

### Categorie

Scopri di più su MATLAB Coder in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by