This is a matlab HW that I need the code for, if someone could help me figure this out it would be appreciated.
IF YOU HAVE ANY DOUBTS COMMENT BELOW I WILL BE THERE TO HELP YOU
ANSWER:
CODE:
format long
inp2 = input('Enter the number of terms : ','s');
m = str2double(inp2);
t = 0;
s = 1;
for i = 1:m
for j = 1:i
t = sqrt(2 + t);
end
s = s * (t / 2);
t = 0;
end
s = 2 / s;
disp(s);
THANKS
OR
CODE:
clc
clear all
n=input('enter the valus of terms you need i.e n :'); % getting
input for number of function from opeartor
for i=2:n
x(1)=(sqrt(2)); %defining first term without condsidering 2
x(i)=(sqrt(2+x(i-1))); %getting all numerator for (2/pi) as subject
of equation
end
for i=1:n
x(i)=(x(i))/2;
y(i)=(1/x(i)); %here we shall make pi as subject of our equation so
we shall get eqm for (pi/2)
end
for i=1:n %loop for product of all numbers
if i==1
diff_pi(1)=y(1);
else
diff_pi(i)=y(i)*diff_pi(i-1);
end
end
absdiff= (pi)-2*diff_pi(n); %required answer
Diff_pi=2*diff_pi(n); %required answer
fprintf('***************************************************\n');
fprintf('for %1f terms the estimeted value of PI = %1.10f
with\n',n,Diff_pi);
fprintf('an absolute differnce of %1.8f with pi in
MATLAB\n',absdiff);
This is a matlab HW that I need the code for, if someone could help me figure this out it would b...
part 2 to the problem in matlabthis is the hint that came with the problem The value of T can be estimated from the following equation: In your script file, estimate the value of t for any number of terms. You must ask the user for the desired number of terms and calculate the absolute error/difference between your calculation and the built-in MATLAB value ofpi. Display your results with the following message (including the asterisks) where II is the number...
MATLAB help! I have some MATLAB Assignment to do, the proffesor requires all the small parts in order to get full credit. Help me out, thank you f LAB SECTION NAME HW6P3 (30 points) following are infinite series representations of the function, un pra i a script file HW6P3 that determines the value of the function from the sum of the series for a given value of x. The program (1 pt) must prompt the user to enter a value...
This exercise is also from C++ How do I even figure this out? please help me solve so I can get the answer correctly! Question 28 10 pts (SHORT ANSWER) Define a function named findEvenOrOdd that has 1 int parameter: num. When the function is called, it should use an if/else statement -OR- conditional expression to determine whether the variable num is an even or odd number and display appropriate message as follows: • If the value in num is...
Matlab Help I understand and already did 2a. Need help with the Matlab part (2b). 2. (15 points) The Maclaurin series expansion of sin(x) is given by 3 sin)39 estimate the true value of sin(T/3). Calculate the truncation error (true percent relative error). (error between current and previous estimate) falls below 0.01%. Document the final value, the (a) Use the first three terms in this equation to calculate the value of sin(T/3). Use your calculator to (b) Now write a...
i need the answer to be on a MatLab window 1. Consider the following equation, which represents the concentration (c, in mg/ml) of a drug in the bloodstream over time (t, in seconds). Assume we are interested in a concentration of c2 mg/ml C3te-0.4t A. Estimate the times at which the concentration is 2 mg/ml using a graphical method Be sure to show your plot(s). Hint: There are 2 real solutions B. Use MATLAB to apply the secant method (e.g....
matlab 1. Write a MATLAB user-defined function that finds the largest element(s) of a matrix. Name the function [max_value, max_index] - LASTNAMES matrix max (x), where input argument x is a vector or matrix (not a scalar), and the outputs are the maximum value(s) and indexes of the maximum value(s) of the mput x. Do not use MATLAB functions max() or find(). Use loops and if branches to determine the maximum elements of matrix. Check for correct number and valid...
Use the following pseudocode for the Newton-Raphson method to write MATLAB code to approximate the cube root (a)1/3 of a given number a with accuracy roughly within 10-8 using x0 = a/2. Use at most 100 iterations. Explain steps by commenting on them. Use f(x) = x3 − a. Choose a = 2 + w, where w = 3 Algorithm : Newton-Raphson Iteration Input: f(x)=x3−a, x0 =a/2, tolerance 10-8, maximum number of iterations100 Output: an approximation (a)1/3 within 10-8 or...
II. Using Newton’s method, write a MATLAB program to find the fixed point of the following function: ?(?) = √? + ?? accurate to at least 8 decimal places. (HINT: finding the fixed point of f(x) is the same as finding the zero of g(x) = f(x) − x. ) The output of this program should display in a single table (i) the solution for the fixed point, (ii) the initial guess, (iii) the number of iterations it took to...
Help with SIMULINK of Matlab: I want to put the transfer function,, but how do I put function 2, so that it comes out as well as the original function, what should I put in the numerator and denominator? .. I know that I cannot use the constant (s) in the block, for that reason I find it difficult to put that equation in the block and the program works for me! PLease, write clearly the final answer for numerator...