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

Help writing a MATLAB program please. for problem 3.2. Thanks f(x)=(1+x)^1/3 = 1

ID: 3677433 • Letter: H

Question

Help writing a MATLAB program please. for problem 3.2. Thanks

f(x)=(1+x)^1/3 = 1+1/3 x - 1.2/3.6 x^2 + 1.2.5/3.6.9 x^3 - 1.2.5.8/3.6.9.12 x^4 +... The binomial expansion for (1 + x)n, where n is an integer, is as follows(1+x)^n, where n is an integer, is as follows: (1+x)^n = 1+nx+ n(n-1)x^2/2! + n(n-1)(n-2)x^3/3! + .... +n(n-1)(n-2)...(n-r+2)x^r-1/(r-1)! +...+ x^n Construct a MATLAB program that will evaluate (1 + x)^n by both the series and by an arithmetic statement for n = 10 and 1.0 x 10.0 in steps of 0.5. Print out the results in a table as shown in Table P3.2..3 This project is axmodification of Project P2.2 Instead of making the program interactive, enter the following altitudes, z2, at which the atmospheric are to be determined by linear interpolation using

Explanation / Answer

1)matlab program

py=1;
y=ones(1,20);
i=1;
for x=1.0:0.5:10.0
for k=1:10;
py=py*((1/3)-(k-1))*(x/k);
y(1,i)=y(1,i)+py;

end
x
y(1,i)
i=i+1;
end

output:

x =

1


ans =

1.2545


x =

1.5000


ans =

1.0003


x =

2


ans =

0.9435


x =

2.5000


ans =

8.1580


x =

3


ans =

-5.2422e+003


x =

3.5000


ans =

1.7618e+007


x =

4


ans =

-2.2288e+011


x =

4.5000


ans =

9.0972e+015


x =

5


ans =

-1.0601e+021


x =

5.5000


ans =

3.1931e+026


x =

6


ans =

-2.2900e+032


x =

6.5000


ans =

3.6491e+038


x =

7


ans =

-1.2180e+045


x =

7.5000


ans =

8.0945e+051


x =

8


ans =

-1.0245e+059


x =

8.5000


ans =

2.3755e+066


x =

9


ans =

-9.7471e+073


x =

9.5000


ans =

6.8632e+081


x =

10


ans =

-8.0666e+089

2)matlab program:

px=1;
temp=1;
y=ones(1,19);
i=1;
n=10;
X=1.0:0.5:10.0;
for x=1.0:0.5:10.0
for r=0:9;
px=(px*(n-r)*x)/factorial(r+1);
y(i)=temp+px;
temp=y(i);

end
i=i+1;
end
A =[X;y];
%store the T,h in table formate in a file
fileID = fopen('exp.txt','w');
fprintf(fileID,'%6s %12s ','x','(1+x)^n');
fprintf(fileID,'%6.2f %8.4f ',A);
fclose(fileID);
%view the content of a file
type exp.txt

output:

x (1+x)^n
1.00 134.3811
1.50 134.3811
2.00 134.3811
2.50 134.3811
3.00 134.3811
3.50 134.3811
4.00 134.3811
4.50 134.3811
5.00 134.3811
5.50 134.3811
6.00 134.3811
6.50 134.3811
7.00 134.3811
7.50 134.3811
8.00 134.3811
8.50 134.3811
9.00 134.3811
9.50 134.3811
10.00 134.3811

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