How to find value of z from the mesh/surface plot when values of x and y are given?

조회 수: 3 (최근 30일)
CY
CY 2012년 9월 14일
댓글: Nathalie 2014년 3월 20일
Through matlab i use finite-difference method to solve standard dispersal equation with initial condition and boundary condition. A mesh/surface plot is then produced. Now, from the mesh/surface plot, how to find the value of z when values of x and y are given?

답변 (1개)

Javier
Javier 2012년 9월 14일
Hello CY
Im going to use the following function (it comes in Matlab help/mesh function).
%Function
[X,Y] = meshgrid(-8:.5:8); %Arbitrary values
R = sqrt(X.^2 + Y.^2) + eps;
Z = sin®./R; %Z is function of X and Y
mesh(Z);
If you want to find the value of Z at X=5 and Y=4, just evalueta the function Z in that point. This mean that you have to evaluate first in R to get the Z desired result (also work for vectors).
NewR=feval(@(xx,yy)[sqrt(xx.^2 + yy.^2)],5,4)
Newz=feval(@(NewR)[sin(NewR)./NewR],NewR)
Hope it helps.
Best regards and if solve your question please grade.
Javier
  댓글 수: 2
CY
CY 2012년 9월 17일
Thank you very much for your reply. However, how about for problem where there's no analytical solution? My problem sound sth like this: The model of dispersal: du/dt=D*(d^2u/dx^2) for t>=0 and x>=0. The initial condition is u(x,0)= -0.0013*(x^2)+0.5673*x+58.1554 for x<=t<=11. The boundary condition is u(0,t)=0 and u(13,t)=0 for 0<=x<=13. By using matlab i obtained numerical solution (using explicit finite-difference method) in the form of a mesh plot. Now, with that mesh plot, i don't know how to obtain the value of, say u(5,6), from the mesh plot. Thank you very much.

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

카테고리

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