Symbols vs Floating points

조회 수: 2 (최근 30일)
Richard
Richard 2012년 3월 28일
This question has to do with the question in this link which Jan has kindly shed some light on.
As mentioned in my comment, I am wondering why my x0 is of class 'sym'. I tried playing around with it and discovered that the problem lies with c0=f(a0,b0).
But I don't know what I can do with it to make it a 'double'. The thing is c0 is a number, no?
  댓글 수: 5
Richard
Richard 2012년 3월 28일
Thanks, Jan.
f = @(a,b) diff(100*a^5+b, sym('a'));
a0=10;
b0=10;
c0=f(a0,b0);
x0 = [a0,b0,c0];
The curly brackets aren't actually there (though the square ones are) -- I thought that using the curly ones in this forum gives the code font -- sorry it is really me being stupid!
Jan
Jan 2012년 3월 28일
The formatting in this forum is not intuitive.

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

채택된 답변

Jan
Jan 2012년 3월 28일
Your f contains the term "sym('a')". Therefore the results get the type sym also. Perhaps you want to use the command double to make the symbolic expression numerically.
  댓글 수: 1
Richard
Richard 2012년 3월 28일
Hi, Jan, Thanks a lot! It is fixed now! :)

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

추가 답변 (0개)

제품

Community Treasure Hunt

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

Start Hunting!

Translated by