How to solve an equation using "solve" and get a decimal approx?

I'm solving an equation for x using "solve(eqn,x)" and everything works fine but I get the fraction answer and I want the decimal answer. How can I change it?

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 12월 7일
eq='x^2-2*x-7'
s=double(solve(eq))

추가 답변 (0개)

카테고리

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

태그

질문:

2014년 12월 7일

편집:

2022년 7월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by