Hi i'm taking an introductory course to matlab at Fau and i'm having a little trouble with my first project. Seeing as how this looks completely foreign to me, I have no clue what to do actually. I was wondering if someone could help me out. This is the project template:
Develop a computer program in MATLAB that will evaluate the following function for 0.9 ≤ x ≤ 0.9 in steps of 0.1 by:
A) an arithmetic statement .
B) by series allowing for as many as 50 terms. However, end adding terms when the last term only affects the 6th place in the answer.
The function and its series expansion is:
f(x)= (1+x^2)^.5= 11/2x^2 + 1/2 x 3/4x^4  1/2 x 3/4 x 5/6x^6 +....
Print out a table (to a file) in the following format; use 6 decimal places for f(x).
X f(x)(by arith stm) f(x)(by series) ]
0.9

0.8

0.7

 ...

 ...

0.7

0.8

0.9

and there should be one last row that says # of terms used in the series
This program should be written off of these examples...
Example 2.3
Code:
% while1.m
% Calculation of e^x by a Taylor series using a while loop. The 'input
% statement' is used to establish the exponent, x. A 'while loop' is
% used in determining the series solution. In this example term(n) is
% obtained by multiplying term(n1) by x and dividing by the index n.
clear; clc;
x=input('enter a value for the exponent x \n');
n=1;
term=1.0;
ex=1.0;
while abs(term) > ex*1.0e6
term=term*x/n;
ex=ex+term;
n=n+1;
if n > 50
break;
end
end
disp(x); disp(ex);
And
EXAMPLE 2.2
Code:
% exB.m
% The program calculates of e^x by both an arithmetic statement (ex2)
% and by a Taylor series (ex1), where 0.5< x <0.5. A 'for loop' is
% used to determine the x values. In the series part of the program,
% the 'sum' function is used to sum all the terms calculated in the
% inner 'for loop'. Fifty terms are used in the series.
clear; clc;
xmin=0.5; dx=0.1;
% Table headings
fprintf(' x ex1 ex2 \n');
for i=1:11
x=xmin+(i1)*dx;
ex2=exp(x);
for n=1:50
term(n)=x^n/factorial(n);
end
ex1=1.0+sum(term);
fprintf('%5.2f %10.5f %10.5f \n',x,ex1,ex2);
end
If someone could at least tell me how to go about starting to write this program. I would be very appreciative.
Thanks,
stephan
P.s. I tried to get the appropriate spacings to translate over to this text box but it just wasn't having it.