Unrecognized function or variable 'x'.

조회 수: 4 (최근 30일)
Anonymous
Anonymous 2020년 2월 12일
댓글: Walter Roberson 2020년 6월 12일
Here is the code that i worte:
% Let's solve the nonlinear system below using successive
% substitution
%x^2=5-y^2
%Y+1=x^2
%Guess
x1=1.5;
x2=1.5;
% Successive Substitution
for i=1:10
y1=x.^2-1;
y2=sqrt(5-x.^2);
end
I keep getting the error Unrecognized function or variable 'x'. Can someone explain what I am missing?

답변 (2개)

John D'Errico
John D'Errico 2020년 2월 12일
Where exactly did you define the value of x?
I see this line:
%x^2=5-y^2
But there is the minor flaw of a comment. Anyway, that does not define a variable named x. You cannot hve x^2 on the left side of an assignment.
Now, read the error message:
Unrecognized function or variable 'x'.
So, I'll ask again, where did you define x? (You did not.)
  댓글 수: 2
Anonymous
Anonymous 2020년 2월 12일
I am not very sure how to do that. This is all the code my teacher gave me to run but i keep getting the code
John D'Errico
John D'Errico 2020년 2월 12일
If you do not know how to do something as simple as assign some value to a variable named x, then it would seem you need to start at the beginning. Read the getting started tutorials. Sorry, but it is time to at least read the very beginning of the manual. Even the very first page will tell you as much as you need. But if you do not spend the time to learn what you are doing, then you will be asking constant questions like this, to please teach you the very most basic ideas.
Fir some reason, it seems like you have figured out how to assign values to the variables x1 and x2. (Hint.) But then you never used them.
Seriously, you need to read the manual.

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


Jianling Zhao
Jianling Zhao 2020년 6월 10일
Unrecognized function or variable 'oaxes'.
  댓글 수: 3
Jianling Zhao
Jianling Zhao 2020년 6월 12일
>> b(1:5) = Account
The following error occurred converting from Account to double:
Conversion to double from Account is not possible.
Walter Roberson
Walter Roberson 2020년 6월 12일
I have no idea what datatype Account is in your code. What shows up for
whos Account

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by