Undefined function or variable 'x'. help

Hi, I'm very new to matlab and i'm trying to write a function that outputs x and y when you input a, b and c (polynomial) and i get Undefined function or variable 'x' when i try to run it.
This is my function currently
function [a,b,c] = Polynomial(x,y)
a=input(a);b=input(b);c=input(c);
g=[a b c];
x=[1:0.01:2];
y=polyval(g,x);
plot(x,y)
end

댓글 수: 3

Walter Roberson
Walter Roberson 2017년 12월 15일
How are you invoking the function?
Why are you accepting x and y as inputs, but then assigning new values to them?
George Connett
George Connett 2017년 12월 15일
I didn't mean to accept them as inputs, thought having them after the function name i.e. Polynomial(x,y) meant they were to be outputted.
Wanted to type Polynomial to invoke the function.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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

태그

질문:

2017년 12월 15일

댓글:

2017년 12월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by