Answered step by step
Verified Expert Solution
Question
1 Approved Answer
To whom ever answered the question previously, the += you used in the MatLab code, my version of MatLab doesnt like it. Im running 2018.
To whom ever answered the question previously, the += you used in the MatLab code, my version of MatLab doesnt like it. Im running 2018. I believe that the code looks good compared to previous examples I have work, but I am not getting the correct value of pi. I am not getting the same answers that are displayed. I get error messages when using the += and when I try variations of =+, ==, +== and soforth I get very small decimal values, not 3.14.........
F Editor E: Engr. 104-1 MatLab' Emslie Hv/17.m Emslie HWiZm file can be opened as a Live Script.For more information, see Creating Live Scripts for k-1in pit 1/ (k 2): pi-sqrt (6 pi): fprintf ("n-ld, Value of Pi -.Brn",n,pi) 24 %% b) % when your script is working, replace the input tatment with a for loop, a with a loop index, n, which goes from 1,000 to 10,000 in incirments of % 1,000. You will now have a loop inside of a loop. This outer loop will t set n, and your previous code, constraining a loop for the summation, will compute pi tor that value ot n. Don't forget this outer ioop,s end t statment. The result should be a line printed for each computation using t a different value of n. 26 28 29 30 A 32 for n-1000: 1000:1000 35- 36- pi-o: 38 Command Window Error: Incorreat use of operator. To assign a value to a variable, use"To compare values tor equality, use script LAB R2018a MATLAB R2018a F Editor E: Engr. 104-1 MatLab' Emslie Hv/17.m Emslie HWiZm file can be opened as a Live Script.For more information, see Creating Live Scripts for k-1in pit 1/ (k 2): pi-sqrt (6 pi): fprintf ("n-ld, Value of Pi -.Brn",n,pi) 24 %% b) % when your script is working, replace the input tatment with a for loop, a with a loop index, n, which goes from 1,000 to 10,000 in incirments of % 1,000. You will now have a loop inside of a loop. This outer loop will t set n, and your previous code, constraining a loop for the summation, will compute pi tor that value ot n. Don't forget this outer ioop,s end t statment. The result should be a line printed for each computation using t a different value of n. 26 28 29 30 A 32 for n-1000: 1000:1000 35- 36- pi-o: 38 Command Window Error: Incorreat use of operator. To assign a value to a variable, use"To compare values tor equality, use script LAB R2018a MATLAB R2018a Thanks for the help, this one is kicking my butt.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started