Question

Calculate the following summation with user input n, and plot S versus k graph.

Can you please make matlab solve it?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

% Matlab script to input n and calculate the value of summation and plot S vs k
% input of n
n = input('Enter the value for n : ');

S = zeros(1,n+1); % create a vector to hold n+1 values of S
S(1) = 1; % set the value of S when k = 0
% loop to calculate the value of S for k=1 to n
for k = 1:n
S(k+1) = S(k)+(1/(k.^2+1));
end
% print the result
fprintf('Value of S for n = %d is %.2f\n',n,S(n+1));
% plot S vs k
plot((0:n),S,'b-o');
xlabel('k');
ylabel('S');
title('Plot of S vs k');
%end of script

Output:

Enter the value for n25 Value of S for25 is 2.04 Figure1 File Edit View Insert ools Desktop Window Help Plot of S vs k 2.2 r

Add a comment
Know the answer?
Add Answer to:
Calculate the following summation with user input n, and plot S versus k graph.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using MS Excel, plot a graph of AG (J/mol) versus T (K). Attach graph to repor...

    Using MS Excel, plot a graph of AG (J/mol) versus T (K). Attach graph to repor 6. Provide the equation for your line in the Excel graph. 4:0.0100X1263 R2-0.7663 7. Comparing the equation for your line to the equation AG' = -AS":T + AH". a. Solve for the value of AS. Include units and show your work. woud 207412 Ettega 996 b. Solve for the value of AH". Include units. 8. Determine the value of AG at 298 K. 9....

  • Write a MATLAB script, which asks the user to input the angle xd (in deg) and...

    Write a MATLAB script, which asks the user to input the angle xd (in deg) and then approximates sine of the angle using the first 5 terms of Taylor series as follows: n+12n-1 sin n-1 (2n-1)! 1 Note that x in Taylor's equation is in radian, so make sure to do the conversion first Start with defining the vector n=1:5 and then use element-wise operation and basic MATLAB commands to calculate the summation. To calculate the factorial of any number,...

  • QUESTION #2 PLEASE 1. Derive the transfer function for the circuit shown below. Plot H(s) versus...

    QUESTION #2 PLEASE 1. Derive the transfer function for the circuit shown below. Plot H(s) versus frequency in Hertz, on a semilog scale. Ri 11.3 k Ri 22.6 k R R = 68.1 kN R3 C C 0.01 uF R2 Vout(s) Vin(s) C2 10 (s+5) H(s) = (s+100)(s5000) , (a) draw the magnitude Bode plot 2. For the transfer function and find the approximate maximum value of (H(jw) in dB, (b) find the value of w where 1 for w>5...

  • Mi k2 b yi m2 Figure 5-45 Mechanical system. Assuming that mi 10 kg, m2 5 kg, b 10 N-s/m, k 40 N/...

    mi k2 b yi m2 Figure 5-45 Mechanical system. Assuming that mi 10 kg, m2 5 kg, b 10 N-s/m, k 40 N/m, and k 20 N/m and that input force u is a constant force of 5 N, obtain the response of the sys- tem. Plot the response curves n(t) versus r and y2(t) versus t with MATLAB Problem B-5-23 Consider the system shown in Figure 5-45. The system is at rest for t < 0. The dis placements...

  • MATLAB ONLY MATLAB ONLY 2. (15 pts) Let b (1) n! 20 1) (5pts) Compute b and b 2) (5pts)Let Sb and S-b find the least N in natural numer s.t k-1 S -S 0.01 3) (5pts) Plot the constant function which...

    MATLAB ONLY MATLAB ONLY 2. (15 pts) Let b (1) n! 20 1) (5pts) Compute b and b 2) (5pts)Let Sb and S-b find the least N in natural numer s.t k-1 S -S 0.01 3) (5pts) Plot the constant function which image is S and plot the graph of Sn where n is from 1 to N(from 2-2) 2. (15 pts) Let b (1) n! 20 1) (5pts) Compute b and b 2) (5pts)Let Sb and S-b find the...

  • Input: a directed grid graph G, a set of target points S, and an integer k...

    Input: a directed grid graph G, a set of target points S, and an integer k Output: true if there is a path through G that visits all points in S using at most k left turns A grid graph is a graph where the vertices are at integer coordinates from 0,0 to n,n. (So 0,0,  0,1,  0,2,  ...0,n,  1,0,  etc.) Also, all edges are between vertices at distance 1. (So 00->01, 00->10, but not 00 to any other vertex....

  • Matlab function to solve an inequality that has a summation problem on one side. I have...

    Matlab function to solve an inequality that has a summation problem on one side. I have to write a function that uses a while loop and determines the biggest exponent value(k) in the summation out = symsum(2^i,i,o,k) that exceeds the input n in the inequality out > n so i need it to test the values of k from 1 on until out is the closest over n it can be. this assignment you will write two functions. The first...

  • 3. Sketch the velocity-versus time graph from the following position versus time graph: n) 0.5 1.5...

    3. Sketch the velocity-versus time graph from the following position versus time graph: n) 0.5 1.5 2.5 3.5 t(S) -0.5

  • Questions: Plot a graph showing sin θ₁ versus sin θ₂ for your data. Equation 2 will...

    Questions: Plot a graph showing sin θ₁ versus sin θ₂ for your data. Equation 2 will be used to solve for n₂. 1. Use a linear fit to plot the data and find slope of the line to help determine a value for the index of refraction for the acrylic lens (n₂). Assume that the index of refraction for air (n₁) is 1. Record your experimental value here: n₂= 2. If acrylic glass has a theoretical index of refraction of...

  • Plot a graph of sin(θi) versus sin(θr) I can't seem to get it to plot correctly...

    Plot a graph of sin(θi) versus sin(θr) I can't seem to get it to plot correctly in excel. Can you walk me through the steps to get this to plot? Make sure it's step by step, what to pick for a graph type, x and y etc.. Table 3: Laser and Refraction Cell Data Reflected Angle, Incident Angle, e Sine, (Degrees) Siner (Degrees) (Degrees) (Degrees) 0 0 0 3 0.087 5 0.052 7 0.173 10 0.121 10 0.258 15 0.173...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT