Question

MATLAB CODE. answer the following question in a driver in matlab please.

3. Write a for loop that calculates the first eleven values of the recursive sequence ak = -1(1 - ax-1), do = 10, and stores

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

MATLAB Code:

close all
clear
clc

a(1) = 10;

for i = 2:11
a(i) = a(i-1)*(1 - a(i-1));
end

disp('a =')
for i = 1:11
fprintf('%+20.8e\n', a(i))
end

Output:

Command Window a +1.00000000e+01 -9.00000000e+01 -8.19000000e+03 -6.70842900e+07 4.50030203e+15 -2.02527184e+31 4.10172602e+6

Add a comment
Know the answer?
Add Answer to:
MATLAB CODE. answer the following question in a driver in matlab please. 3. Write a for...
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
  • The matlab code for the following problem is appreciated!! QUESTION 3 Write a function fnfr_plot that...

    The matlab code for the following problem is appreciated!! QUESTION 3 Write a function fnfr_plot that will receive two function handles from elementary math functions which accept a vector to first sort in ascending order then calculate. The script will display the results in two separate Figure Windows with the function names in the title. Submit: fnfr_plot.m Browse My Computer Attach File QUESTION 4 Generate 1x100 random vector, x in the range of 0<x<100 by using rand. Input 2 elementary...

  • Write a MATLAB code to compute the summation of the integers from 1 to 1000 by...

    Write a MATLAB code to compute the summation of the integers from 1 to 1000 by using for-end loop command. Your code should display the value of the summation within the following statement (using fprintf command): The value of the summation of the integers from 1 to 1000 is ???.

  • MATLAB scripts are how multiple lines of code can be executed vs. entering in a line...

    MATLAB scripts are how multiple lines of code can be executed vs. entering in a line of code one at a time through the command window. Write a script that does the following. Only display to the console window what is specified. Creates a 4 x 10 matrix with the 1strow being 1 to 10, the 2ndrow being 11 to 20, the 3rdrow being 21 to 30, and the last row being 31 to 40. The matrix is shown on...

  • I need a matlab code to answer the questions below ICE09B Make an Array Develop a...

    I need a matlab code to answer the questions below ICE09B Make an Array Develop a MATLAB code which will produce an array that looks like the following: 4 10 1. You must start with a blank array and build the array with a DNFL. You can NOT just load the array with an assignment statement. Hint: Use "addition" for your variables Square all values in the array 2. Blackboard will ask you for a screenshot of your properly working...

  • 1) Write a MATLAB script to prompt a user to input two numbers, then assess whether...

    1) Write a MATLAB script to prompt a user to input two numbers, then assess whether the two numbers are equal or not. If the two numbers are equal, display that they are equal in the Command Window. If they are not equal, display that they are not equal in the Command Window. 2) Write a MATLAB script that prompts the user to enter the day of the week using the input function. If the information the user enters is...

  • Please use Matlab and good commenting. 106/); [15] A particular sequence has the recursive formula In+3...

    Please use Matlab and good commenting. 106/); [15] A particular sequence has the recursive formula In+3 = In+1 +sin(tn) where n = 0,1,2,3,... and we have that to = 3.t1 = 1. Use a loop to calculate the first 10000 terms of the sequence. Then display these term values as red circles on a graph. The figure must have a title and axes labels. A table, with headings, must then be created with the first column showing the value of...

  • Using MATLAB code only please! 4. Write a script which does the following (use a while...

    Using MATLAB code only please! 4. Write a script which does the following (use a while loop). a. Creates a random number b. Calculates the sum of random numbers selected, across all loop iterations c. Prints the number of random numbers (the number of loop iterations) which were required to add up to 20 (or more).

  • MATLAB EXPERT PLS HELP!!! SHORT AND SIMPLE QUESTIONS! Just write the code to do the following...

    MATLAB EXPERT PLS HELP!!! SHORT AND SIMPLE QUESTIONS! Just write the code to do the following operations step by step please. You dont need background info on the question Prompt the user to enter x and if x is less than 2 or not an integer, use a while loop to display “Invalid!” and prompt the user to re-enter valid entries. Prompt the user to enter y as a vector of x elements. If the user did not enter in...

  • Please show the code necessary, and explanations on MATLAB. Plotting 11) Plot the function y =...

    Please show the code necessary, and explanations on MATLAB. Plotting 11) Plot the function y = sin(x) from x = 0 to 21. 12) Plot the functions y = x2 z = x2 + 2x + 1 from x = 0 to 2 on the same graph. Scripts: Input and Output 13) Write a script (M-file) to read in a message at the command line using the MATLAB input function and then display the message to the Command Window using...

  • Write the code in java programming language To get some practice with recursion. You can do...

    Write the code in java programming language To get some practice with recursion. You can do all this in one driver program. Write a recursive method to compute the result of the Fibonacci sequence: Fibonacci(N) = Fibonacci(N -1) + Fibonacci(N-2) N == 0 is 0 N == 1 is 1 Testing: Display the result for Fibonacci(N) and the number of function calls for N = 2, 5 and 10.

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