フィルターのクリア

ploting function and its derivative error

1 回表示 (過去 30 日間)
Iqra Akhtar
Iqra Akhtar 2021 年 3 月 9 日
回答済み: Star Strider 2021 年 3 月 9 日
I want to run this code but I am getting error conversion to double from sym is not possible please help
clear all
close all
syms x y z t
f=log(x)+sin(x);
y=diff(f,x,1);
z=diff(f,x,4);
t=diff(f,x,5);
x=0:1;
plot(f,x);
hold on
plot(y,x);
hold on
plot(z,x);
hold on
plot(t,x);
hold off
title('multiple plots of function and its higher order derivatives');
xlabel('x');
ylabel('y');
axis square
grid;

回答 (1 件)

Star Strider
Star Strider 2021 年 3 月 9 日
Use the fplot function:
syms x y z t
f=log(x)+sin(x);
y=diff(f,x,1);
z=diff(f,x,4);
t=diff(f,x,5);
x=0:1;
figure
fplot(f,x);
hold on
fplot(y,x);
fplot(z,x);
fplot(t,x);
hold off
title('multiple plots of function and its higher order derivatives');
xlabel('x');
ylabel('y');
axis square
grid
xlim([0 1E-3]) % <- AADDED (Optional)
.

カテゴリ

Help Center および File ExchangeNumeric Solvers についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by