필터 지우기
필터 지우기

plot symbolic function real part

조회 수: 1 (최근 30일)
john_arle
john_arle 2019년 3월 31일
댓글: Star Strider 2019년 3월 31일
Hello there,
I would like to plot the real part of this symbolic function I have just solved.
Parameters 'a' and 'e' are varying between 5 and 9, and 0.05 and 0.15 respectively.
Unfortunately, it does not work.
Here you go with my code ( solution is a ratio of sum of Bessel functions of order zero).
clc
clear
set(groot,'DefaultAxesFontSize',14)
set(groot,'DefaultLineLineWidth',1.5)
syms a e
A = [besselj(0,-1i*a*e), bessely(0,-1i*a*e); ...
besselj(0,-1i*a), bessely(0,-1i*a)];
b = [-1; -1];
X = linsolve(A, b);
disp(X)
a = linspace(5,9);
e = linspace(0.05, 0.15);
plot(a, e, X)

채택된 답변

Star Strider
Star Strider 2019년 3월 31일
You are plotting a function of two variables, so you need to use a plot that accommodates them, and that your function is symbolic.
Try this:
syms a e
A = [besselj(0,-1i*a*e), bessely(0,-1i*a*e); ...
besselj(0,-1i*a), bessely(0,-1i*a)];
b = [-1; -1];
X = linsolve(A, b);
disp(X)
a = linspace(5,9);
e = linspace(0.05, 0.15);
fsurf(real(X), [5 9, 0.05 0.15])
xlabel('a')
ylabel('e')
Experiment to get the result you want.
  댓글 수: 2
john_arle
john_arle 2019년 3월 31일
Thank you. Any other options that fsurf that I can try?
regards,
Andrea.
Star Strider
Star Strider 2019년 3월 31일
As always, my plesure.
There are several 3D plots that will probably work with your system. See the documentation on fcontour (link), fmesh (link), and fplot3 (link).

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by