필터 지우기
필터 지우기

problem with plotting a 1D graph

조회 수: 3 (최근 30일)
Yamina chbak
Yamina chbak 2020년 12월 1일
댓글: Yamina chbak 2020년 12월 3일
Hi,
I have solved a 2D time problem U(x,y,t), 0<=x,y<=L and 0<=t<=T, by FEM and i get
trisurf(TRI,x,y,U(:,N)) % N number of time steps
% TRI triangle for create mesh
My question is how to write Matab code to see plot 1D for U solution of this problem if I choose for example : U(5,6,t) for all 0<=t<=T and U(x,5,0.15) for 0<=x<=L.
(To simulate 1D problem through a 2D problem ) this what i try write plot but it is not correct
% plot of time : U(5,6,t)
t=linspace(0,2,0.15);
for i=1:np % np number of nodes
find(x(m)==5 & y(m)==6)
end
plot(t,U(:,t))
%%%%%%%%%%%%%
% plot of x : U(x,5,0.15)
t=0.15;
for i=1:np % np numbers of nodes
find(y(m)==5
end
plot(x,U(:,t)
Please i need help
Thanks

답변 (1개)

Stephan
Stephan 2020년 12월 2일
편집: Stephan 2020년 12월 2일
You dont save the results of find anywhere - try:
% plot of time : U(5,6,t)
t=linspace(0,2,0.15);
for i=1:np % np number of nodes
U(i,:) = find(x(m)==5 & y(m)==6)
end
plot(t,U)
  댓글 수: 1
Yamina chbak
Yamina chbak 2020년 12월 3일
Thanks @Stephan for answer my question, but i think i give you my mistaken information.
Look my code what i did it for solving 2d problem and see plot2D :
% i have a list of Nodes
x=Nodes(:,2); y=Nodes(:,3);
np=size(x,1); %number of nodes
T=1;N=21; dt=T/N-1;
for k=1:N
t(k)=(k-1)*dt;
L(:,k+1)=g(x,y,t(k+1)) % a simple function dependant time
b(:)=M+L(:,k+1); % M is a matrix
% solver problem
U(:,k+1)=A\b(:);
end
% Resultat
figure()
trisurf(TRI,x,y,U(:,N))
What I want is to see plot 1D of U(x,pi/2,0.15) solution of this problem with choosing value y=pi/2 and t=0.15 :
plot(x,????)
I apologize for any difficultes that and please help me if you have time
Thanks

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

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by