Polynomial as input in a function.
이전 댓글 표시
I am trying to make a function which takes a polynomial, a maxvalue of x and a minvalue of x. I want to plot the function between max and min with 1000 points.
this is what i have come up with so far:
function [] = Oppgave2(funksjon, intervallMin, intervallMax)
figure
%a
x = [intervallMin:((abs(intervallMin)+abs(intervallMax))/1000):intervallMax]; %Here i create the 1000 points between min and max.
plot(x, funksjon); %Display the function in a figure
end
I want to be able to input funksjon as x.^2-3.*x+2 for example, but i cant make it work. The solution is probably really simple but i am very new to programming in matlab.
Thanks in advance!
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Polynomials에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!