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 - The Fusion of Science and Community**

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

# Matlab help

Loading...

Similar Threads - Matlab help | Date |
---|---|

Matlab MATLab: Not enough inputs for nlinfit | Nov 16, 2017 |

Matlab Help needed to fix a matlab code | Nov 8, 2017 |

New to Matlab, help with vectors | Feb 20, 2016 |

Need help with integral | Dec 23, 2015 |

Communication between Arduino and Matlab Help | Jun 19, 2015 |

**Physics Forums - The Fusion of Science and Community**