error in my code

조회 수: 1 (최근 30일)
justin  Taylor
justin Taylor 2011년 12월 29일
syms x;
f=x^2+x;
M=solve(f);
n=size(M,2);
for i=1:n
if M(i)>1
disp('Ok');
else
disp('Again');
end
end
it show :
>> d
Nhap ham fx^2+x
Error using sym>notimplemented (line 2682)
Function 'gt' is not implemented for MuPAD symbolic
objects.
Error in sym/gt (line 801)
notimplemented('gt');
Error in d (line 5)
if M(i)>1

채택된 답변

Walter Roberson
Walter Roberson 2011년 12월 29일
M = double(solve(f));
  댓글 수: 1
justin  Taylor
justin Taylor 2011년 12월 29일
Thanks ! The problem resolved !

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

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 12월 29일
That's why input is seldomly recommended, especially when you plan on using the result in something important, like solve.
Recommended steps:
  1. Write a function that excepts one input argument
  2. Give this function some error checking to make sure that the one input argument meets the criteria for solve
  3. Do the rest of the stuff and output a reult.
doc function %will be your friend.

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by