필터 지우기
필터 지우기

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 CenterFile Exchange에서 Numeric Solvers에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by