Question

This is a homework for MATLAB. Please answer using MATLAB functions and parameters. The answers are...

This is a homework for MATLAB. Please answer using MATLAB functions and parameters. The answers are to be submitted as a .m script. Don't just list final answers.

Problem 2: Perform the following exercises to find the sum of the first sixty terms of the following series: 1/2 − 2/4 + 3/8 − 4/16 + 5/32 + ...

a) Create a row vector p2a to store the numerators of each term in the series.

b) Create a row vector p2b to store the denominators of each term in the series.

c) Create a row vector p2c to store the signs of each term in the series, e.g. 1 for positive and -1 for negative.

d) Use function sum with the vectors in parts (a-c) to obtain the sum of the series. Put the answer in p2d

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

matlab code

============================================================================================

p2a=1:60;
p2b=2.^(1:60);
p2c=(-1).^(0:59);


p2d=sum((p2a.*p2c)./p2b)

============================================================================================

Output

Add a comment
Know the answer?
Add Answer to:
This is a homework for MATLAB. Please answer using MATLAB functions and parameters. The answers are...
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
  • You need to write scripts for all problems. Each script should contain the comments on each...

    You need to write scripts for all problems. Each script should contain the comments on each line. You also need to publish your scripts to pdf files. 1. (Chapter.1) Store a number with a decimal place in a double variable (the default). Convert the variable to type int32 and store the result in a new variable. (10pts) 2. (Chapter.1) Create a variable ftemp to store a temperature in degrees Fahrenheit F). Convert this to degrees Celsius C) and store the...

  • Matlab code assistance - task 1 and 6 I think I am right and just need...

    Matlab code assistance - task 1 and 6 I think I am right and just need to be pointed in the right direction if I should change anything %% Task 1 % create the 3 row vectors shown in Ex 8 using 3 different approaches Ex 8 = using the colon operator and also the linspace function, create the following row vectors -5 -4 -3 -2 -1 5 7 9 8 6 4 % 1. list the values explicitly (square...

  • MATLAB HELP PLEASE Write a Matlab function that evaluates a sum of sines at a set...

    MATLAB HELP PLEASE Write a Matlab function that evaluates a sum of sines at a set of points. The first term is just a constant (a coefficient with no sine term). Then, each sine term will have a coefficient before it and then an increasing multiple of the angle inside. For example, consider the sum 3 + 4 sin(9)-1.5 sin (20) 2 sin (40)3 sin (50) We recognize that this is the same as 344sin(101+-1.5 sin (20) + 0 sin...

  • Need help with this MatLab exercise. Please show all commands in MatLab. Enter the following matrices...

    Need help with this MatLab exercise. Please show all commands in MatLab. Enter the following matrices and vectors in MATLAB [ 2 -6 3 ] [ 5 ] -3 A= 2 -7 -2 , B= 2 -2 -3 , b= -13 , c= 3 -1 4], d= 0 [ 7 -2 7 [1 -8 -1 ] [ 10 (a) Perform the following operations: AB, BA, CA and Bd (use standard linear algebra multiplication). - 3 (b) Construct a 6 x...

  • Please write the code using matlab 1) i. Create an anonymous function named optimist, that accepts...

    Please write the code using matlab 1) i. Create an anonymous function named optimist, that accepts a single variable as input i Create a row vector Tthat represents the number of seconds in two minutes, starting ii. Call the function optimist on the vector T, store the result in variable R1 and returns the double of that variable from one and ending at a hundred and twenty v. Create an anonymous function named pessimist, that accepts a single variable as...

  • Using matlab... Calculating with vectors. Compute the following values. The value of N will be randomized...

    Using matlab... Calculating with vectors. Compute the following values. The value of N will be randomized at each submission and will be created by the auto grader. Do not modify the given value of N. Note: N will be a positive integer 2 1. o Compute the mathematical expression below and store the result in the variable named x. Your code should work for any positive integer N given. 2N 1 1 2 3 4 o Hint: Create a numerator...

  • MATLAB Only MATLAB Only MATLAB Only Indicated in the script below, write a function, called arbpoly3,...

    MATLAB Only MATLAB Only MATLAB Only Indicated in the script below, write a function, called arbpoly3, that accepts two inputs: i) a row vector, called c, containing the coefficients of the polynomial, starting with the coefficient for the lowest degree term, which is the constant term. ii) a row vector, called x, which is the set of real numbers where the polynomial is to be evaluated. The output, y, will be a vector containing the values of the polynomial, evaluated...

  • PLEASE USE MATLAB COMMANDS THANK YOU Use Matlab to graph the functions f(x) = 3xsin(3x) and...

    PLEASE USE MATLAB COMMANDS THANK YOU Use Matlab to graph the functions f(x) = 3xsin(3x) and g(x)= 12 - 2x² so that you can read off the point(s) of intersection (if any), accurate up to two decimal places. 1) Write down the Matlab command(s) you used to create the x-vector. 2) Write down the Matlab command(s) you used to produce the vectors containing the f- and g-function values. 3) Write down the Matlab command(s) you used to plot the graphs....

  • answer 4, 5, 6, 7 using matlab Homework 10 1. Write the correct first-line syntax for...

    answer 4, 5, 6, 7 using matlab Homework 10 1. Write the correct first-line syntax for a user defined function that is named Feynman and has input variables q and e, and outputs L and M. (Comment out of this line). 2. Using zeros, ones, and eye commands write the one line syntax to create the following matrix: 00000 01100 01010 01001 3. Write the syntax for the user defined function that calculates the surface area and volume of a...

  • Problem 3 (13 pts): (modified from Attaway Problem 3.39) a) (5 pts) Using the Matlab rand () func...

    Problem 3 (13 pts): (modified from Attaway Problem 3.39) a) (5 pts) Using the Matlab rand () function, create a script that generates a row vector (1 row X 20 columns) of random numbers, each with magnitude between 0 and 5 b) (3 pts) Use the round() function to turn all of the values into whole numbers by rounding down (truncate the decimal part on your vector) c) (5 pts) Add code to your script to generate a new vector...

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
ADVERTISEMENT