Filter löschen
Filter löschen

ploting function and its derivative error

1 Ansicht (letzte 30 Tage)
Iqra Akhtar
Iqra Akhtar am 9 Mär. 2021
Beantwortet: Star Strider am 9 Mär. 2021
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;

Antworten (1)

Star Strider
Star Strider am 9 Mär. 2021
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)
.

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by