Create a function file named Func01_p4.m which has 4 arguments: x, a, b, and c. The independent variable being x of the function below:
Y = ax^2+bx+c
Download the data04_02.txt from the course website. This file consists of 3 space-­‐delimited integers. In your main script file, store these integers into the respective variables: a, b, and c. These will be the coefficients of the 2nd degree polynomial you will be integrating. Any time you refer to @Func01_p4 make sure you use the appropriate arguments (a, b, and c).
Display the polynomial like you were writing an equation (see below):
(7)*x^2 + (1)*x + (3)
where 7, 1, and 3 are the coefficients a, b, and c respectively that you imported from the file (which are different from these coefficients).
I got the part where it asks to store the integers into respective variables, but I don't get what it means by Display the polynomial like you were writing an equation.

 채택된 답변

sixwwwwww
sixwwwwww 2013년 12월 3일

3 개 추천

you can do something like this:
fprintf('(%d) * x^2 + (%d) * x + %d\n', a, b, c)

댓글 수: 5

Ish
Ish 2013년 12월 3일
What goes in the %d?
in 1st %d value of 'a' goes, in 2nd %d value of 'b' goes and in 3rd %d value of 'c' goes For example, if you have
a = 5;
b = 10;
c = 15;
then
fprintf('(%d) * x^2 + (%d) * x + %d\n', a, b, c)
will give you output:
(5) * x^2 + (10) * x + 15
Ish
Ish 2013년 12월 3일
ok, thank you!
Ish
Ish 2013년 12월 3일
just one more question. Where did you get the "n"?
sixwwwwww
sixwwwwww 2013년 12월 3일
'\n' mean new line. so after executing fprintf command the cursor goes to next line on the command window. Fpr more infomation you can see:

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

추가 답변 (0개)

카테고리

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

질문:

Ish
2013년 12월 3일

댓글:

2013년 12월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by