I have everything correct, that is when I put in a value for n=10 I get the right results however I want to enter in more than one number at a time to give me three different results like a vector like [ 10 20 30] but I am just clueless as to how to go about this. the dots are there because i thought if i did that it might treat it the input as vector but i guess not I am stuck.(adsbygoogle = window.adsbygoogle || []).push({});

n=input('Enter the number of terms as a vector:');

l=0;

s=pi;

for k=0:1:n

l=l+sqrt(12)*(((-3).^(-k))./(2*k+1));

a=l;

j=abs(s-a);

end

fprintf('\n the diffrence between the series and pi is:%i\n\n',j)

fprintf('\n the diffrence: %g\n\n',j)

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab help

**Physics Forums | Science Articles, Homework Help, Discussion**