how to plot graph using fplot command

syms x
y=exp(x)
fplot(y)
I got the following errpor. If I replace exp(x) by sin(x) then the code shows graph in the default range

댓글 수: 3

What error?
The code seems to be working fine here and on my R2021a.
syms x
y = exp(x);
fplot(y)
Also, run this code and share the output you get.
which exp -all
yogeshwari patel
yogeshwari patel 2023년 12월 3일
it is not working in 2023 a MATLAB VERSION
Dyuman Joshi
Dyuman Joshi 2023년 12월 3일
편집: Dyuman Joshi 2023년 12월 3일
How is it not working?
If you get an error, share the full error mesage i.e all of the red text.
if something else, then specify in detail.

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

답변 (2개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 3일

0 개 추천

Alt syntax for using fplot is this one:
FUN = @(x)exp(x);
fplot(FUN), grid on
figure
% Or a bit better controlled way by specifying the range of x values
fplot(FUN, [-2, 2])
grid on

댓글 수: 1

yogeshwari patel
yogeshwari patel 2023년 12월 3일
I want to know the reason why fplo(y) is not working and we have to define it as f=@exp(x)

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

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 3일

0 개 추천

It is likely that you have saved one of your MATLAB files by fplot.m name or you have named/stored one of your variables by fplot.
(1) Run this command:
>> which fplot % See whether it is a MATLAB builtin function or variable or you saved M-file
If it is one of your saved M-files, just rename your M-file, e.g.: fplot_1.m
(2) Run this command:
>> clear all
(3) Now, you should be able to execute fplot() fcn.
All the best.

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

2023년 12월 3일

편집:

2023년 12월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by