how can i write a program to receive an orbitrary function from user and then it draw the function on the interval between a to b ?

답변 (1개)

David Hill
David Hill 2021년 1월 30일

0 개 추천

Look at str2func
f=str2func(input('Input a function of a single variable to be graphed [e.g., @(x)x.*cos(x)-x.^2.*sin(x)]','s'));
a=0;
b=pi;
x=linspace(a,b,1000);
plot(x,f(x));

카테고리

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

질문:

2021년 1월 30일

답변:

2021년 1월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by