필터 지우기
필터 지우기

How to plot matrix data ?

조회 수: 3 (최근 30일)
Shangeetha Mahendran
Shangeetha Mahendran 2018년 12월 19일
답변: Shangeetha Mahendran 2018년 12월 19일
why figure 4, 5 are blanck?
sol =pdepe(m,@pdefun,@pdeic,@pdebc,xmesh,zspan);
u=sol(:,:,1)
%%
surf(x,z,u)
xlabel('radi')
ylabel('height')
%%
figure
plot(x/R,u(end,:)/u0)
xlabel('radi')
ylabel('concentration')
%%
figure
plot(z/L,u(:, end)/u0)
xlabel('height')
ylabel('c')
%%
figure
for i =1:zn
hold on
plot(r/R,u(i,:))
hold off
end
xlabel('position ')
ylabel('concentration in every row')
%%
figure
for ii =1:xn
hold on
plot(z/L,u(:,ii))
hold off
end
xlabel('position ')
ylabel('concentration in every row')
  댓글 수: 2
madhan ravi
madhan ravi 2018년 12월 19일
use '-ok' as marker
Shangeetha Mahendran
Shangeetha Mahendran 2018년 12월 19일
I don't get that. you mean in figure 4 and 5?

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

채택된 답변

KSSV
KSSV 2018년 12월 19일
figure
hold on
for i =1:zn
plot(r/R,u(i,:),'.k')
hold off
end
xlabel('position ')
ylabel('concentration in every row')
%%
figure
hold on
for ii =1:xn
plot(z/L,u(:,ii),'.')
hold off
end
xlabel('position ')
ylabel('concentration in every row')
  댓글 수: 1
Shangeetha Mahendran
Shangeetha Mahendran 2018년 12월 19일
I have attached the full code here. still it's not working.
function pde1
clc; clear; close all
m=1; %cylindrical geometry
R=3e-3; %radius of lumen (m)
dm = 13.04e-6; % TM thickness (m)
r1 =R + dm; %radius of outer surface of membrane (m)
L=1.2; %height of the membrane (m)
Q = 6.5e-9; %volumetric flow rate
D=1.76e-9; %diffusion coefficient of ammonia in liquid m2/s
RT = 2477.6; %J/mol
H = 1.62; %Henry's law constant Pam^3/mol
u0= 285.1; %inflow concentration
zn=10; % grid line z (actually z denoted by t
xn = 10; % grid-steps channel x-axis(radius side)
xmesh = linspace(0,R,xn);
zspan =linspace(0,L,zn); %counter point of length% spatial solution domain (m)
dx = 1/(xn-1);
x = [xmesh]; %x vector
z =[zspan]; %t vector
U_a = Q/3.14/R^2; % average velocity
sol =pdepe(m,@pdefun,@pdeic,@pdebc,xmesh,zspan);
u=sol(:,:,1)
surf(x,z,u)
xlabel('radi')
ylabel('height')
figure
plot(x/R,u(end,:)/u0)
xlabel('radi')
ylabel('concentration')
figure
plot(z/L,u(:, end)/u0)
xlabel('height')
ylabel('c')
figure
hold on
for i =1:zn
plot(r/R,u(i,:),'.k')
hold off
end
xlabel('position ')
ylabel('concentration in every row')
figure
hold on
for ii =1:xn
plot(z/L,u(:,ii),'.')
hold off
end
xlabel('position ')
ylabel('concentration in every colomn')
%%
function [c,f,s]= pdefun(x,t,u,DuDx)
c = U_a/D;
f = DuDx;
s=0;
end
%% initial condition
function u0 = pdeic(x)
u0 =285.1;
end
%%
function [pl,ql,pr,qr] = pdebc(xl,ul,xr,ur,t)
pl=0;
ql=1;
pr=u0;
qr=1;
end
save('results.mat');
end

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

추가 답변 (1개)

Shangeetha Mahendran
Shangeetha Mahendran 2018년 12월 19일
This is the correct code. and i have to get out put like attached images.
function pde1
clc; clear; close all
m=1; %cylindrical geometry
2.JPG
R=3e-3; %radius of lumen (m)
dm = 13.04e-6; % TM thickness (m)
r1 =R + dm; %radius of outer surface of membrane (m)
L=1.2; %height of the membrane (m)
Q = 6.5e-9; %volumetric flow rate
D=1.76e-9; %diffusion coefficient of ammonia in liquid m2/s
RT = 2477.6; %J/mol
H = 1.62; %Henry's law constant Pam^3/mol
u0= 285.1; %inflow concentration
zn=10; % grid line z (actually z denoted by t
xn = 10; % grid-steps channel x-axis(radius side)
xmesh = linspace(0,R,xn);
zspan =linspace(0,L,zn); %counter point of length% spatial solution domain (m)
dx = 1/(xn-1);
x = [xmesh]; %x vector
z =[zspan]; %t vector
U_a = Q/3.14/R^2; % average velocity
% u =zeros(tn,xn);
%removal = (C_row(1)-C_row(tn))/3.14/R.^2;
% pi()
%%
%U_z =zeros(1,xn);
%for ii=1:xn
%U_z(ii) =2*U_a *(1- x(ii)^2/R^2);
%end
%%
sol =pdepe(m,@pdefun,@pdeic,@pdebc,xmesh,zspan);
u=sol(:,:,1)
surf(x,z,u)
xlabel('radi')
ylabel('height')
figure
plot(x/R,u(end,:)/u0)
xlabel('radi')
ylabel('concentration')
figure
plot(z/L,u(:, end)/u0)
xlabel('height')
ylabel('c')
figure
hold on
for i =1:zn
plot(x/R,u(i,:),'.k')
hold off
end
xlabel('position ')
ylabel('concentration in every row')
figure
hold on
for ii =1:xn
plot(z/L,u(:,ii),'.')
hold off
end
xlabel('position ')
ylabel('concentration in every column')
%%
function [c,f,s]= pdefun(x,z,u,DuDx)
c = U_a/D;
f = DuDx;
s=0;
end
%% initial condition
function u0 = pdeic(x)
u0 =285.1;
end
%%
function [pl,ql,pr,qr] = pdebc(xl,ul,xr,ur,z)
pl=0;
ql=1;
pr=u0;
qr=1;
end
save('results.mat');
end

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by