Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a MATLAB function B=polint(P) which accepts as an input a polynomial P wri

ID: 3146437 • Letter: W

Question

Write a MATLAB function B=polint(P) which accepts as an input a polynomial P written through the standard basis (see Exercises 3 and 4 of this project). The function has to calculate the indefinite integral of the polynomial assigning a value 5 to an arbitrary constant. The output has to be a polynomial written through the standard basis as well. Do not use the MATLAB built in function int(P) in your code. Suggested commands within your code: syms x, sym2poly, poly2sym, length. A single for loop can be used.

Explanation / Answer

%%% Matlab function %%%

function [B] = polint (p)

c=5;
l=length(p);
f=poly2sym(p);
for n=1:l
    B(n)=p(n)/(l-n+1);
end
B(end+1)=c;
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote