Displaying a quadratic equation

조회 수: 2 (최근 30일)
James
James 2013년 9월 24일
댓글: James 2013년 9월 30일
Hi im very new to Matlab and help would be greatly appreciative
Consider the quadratic equation of the form: ax^2 + bx + c = 0, where a,b,c are constants
(a) Write a MATLAB function having the coefficients a, b, c as input arguments to determine the quadratic roots of the equation. Specifically, display the two roots in the Command Window using the following format:
The first root = r1 The second root = r2
(b) Utilize the function created in part (a) to find the roots of the quadratic equations specified by the Lab TA. Tabulate the results.
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 24일
This a homework. What have you done so far? What problem have you encountered?
James
James 2013년 9월 30일
function parallel = parallel® R=(1e4); rp(1,1) = R; for n = 1:99 rp(n+1) = (rp(n)*R)/(rp(n) + R); bar(rp) end n = 1:100; plot(n, rp(n))
I got the answer I was missing a semi colon that why i was getting an error

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

채택된 답변

Matt J
Matt J 2013년 9월 24일
편집: Matt J 2013년 9월 24일
The roots() command will be helpful, see "doc roots" for usage. The disp command should also help, e.g,
>> disp(['Here is a number, ', num2str(3), '. It is the number three.'])
displays,
Here is a number, 3. It is the number three.

추가 답변 (1개)

James
James 2013년 9월 30일
I got the answer I was having problem with a simple problem i was missing a semi colon lol
function parallel = parallel® R=(1e4); rp(1,1) = R; for n = 1:99 rp(n+1) = (rp(n)*R)/(rp(n) + R); bar(rp) end n = 1:100; plot(n, rp(n))

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by