How to plot in 2D this equation?

조회 수: 2 (최근 30일)
Athira T Das
Athira T Das 2023년 4월 20일
댓글: Dyuman Joshi 2023년 4월 20일
I have an equation and need to plot this like
  댓글 수: 3
Athira T Das
Athira T Das 2023년 4월 20일
clc;close all;clear all;
x0 = -5:.01:5;
y0 = x0;
n=10;a=0.1;
w0=0.01;m=0;
r=(sqrt(x0.^2 +y0.^2));
U = (sinh(a.*r./w0)).*exp(-(r.^2/w0^2));
[X0,Y0] = meshgrid(x0,y0);
f = @(x0,y0) ((sinh(r./w0)).^n).*exp(-(r.^2/w0^2)).*((x0+1i.*y0).^m);
surf(X0,Y0,abs(f(X0,Y0)))
shading interp
Dyuman Joshi
Dyuman Joshi 2023년 4월 20일
I think 'r' is not supposed to be a constant in the definition of E and in the function handle, f. Can you clarify this?

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

채택된 답변

KSSV
KSSV 2023년 4월 20일
x0 = linspace(-5,5,200);
y0 = x0;
n=10;a=0.1;
w0=0.01;m=0;
[x0,y0] = meshgrid(x0,y0) ;
r=(sqrt(x0.^2 +y0.^2));
f = @(x0,y0) ((sinh(r./w0)).^n).*exp(-(r.^2/w0^2)).*((x0+1i.*y0).^m);
surf(x0,y0,abs(f(x0,y0)))
shading interp

추가 답변 (0개)

카테고리

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