Question

What is the matlab code for the following: With x_1 = 23, x_2 = 66, and...

What is the matlab code for the following: With x_1 = 23, x_2 = 66, and x_n = 3x_(n−1) + 5x_(n−2) mod(100), n ≥ 3 we will call the sequence un = x_n/100, n ≥ 1, the text’s random number sequence. Find its first 14 values.

Homework Answers

Answer #1

function u = modulus (x1,x2)
x = zeros(1,14);
x(1) = x1 ;
x(2) = x2 ;
for i = 3 : 14
    x (i) = mod ((3 * x(i-1) + 5*x(i-2)) , 100) ;
end

for i = 1 : 14
    u(i) = x(i)/100;
end

// this function takes x1 and x2 as input

modulus(23,66)

ans =

Columns 1 through 13

    0.2300    0.6600    0.1300    0.6900    0.7200    0.6100    0.4300    0.3400    0.1700    0.2100    0.4800    0.4900    0.8700

Column 14

    0.0600

Please rate

Know the answer?
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
Similar Questions
How do I do this in the program Maple? With x_1 = 23, x_2 = 66,...
How do I do this in the program Maple? With x_1 = 23, x_2 = 66, and x_n = 3x_(n−1) + 5x_(n−2) mod(100), n ≥ 3 we will call the sequence un = x_n/100, n ≥ 1, the text’s random number sequence. Find its first 14 values.
The following code must be written in matlab. I have a list of inidices say L...
The following code must be written in matlab. I have a list of inidices say L = [1,2,5,10,6,7,] I want to loop through indices in a for loop from i=1:n , n=100 but I must skip all indices that are not in the list L How can I do this if I am not allowed to use the ismember function. Thankse
In the code space provided in Matlab Grader, create a function that: 1. Accepts an input...
In the code space provided in Matlab Grader, create a function that: 1. Accepts an input matrix A as its only input argument. Matrix A is a 3x3 matrix of random integers between 1 and 4 2. Produces and output matrix B as its only output argument. Matrix B will also be a 3x3 matrix. 3. Calculates the elements of matrix B such that: a. the values of B along the diagonal are equal to the respective elements in A...
Consider the following sequence: 0, 6, 9, 9, 15, 24, . . .. Let the first...
Consider the following sequence: 0, 6, 9, 9, 15, 24, . . .. Let the first term of the sequence, a1 = 0, and the second, a2 = 6, and the third a3 = 9. Once we have defined those, we can define the rest of the sequence recursively. Namely, the n-th term is the sum of the previous term in the sequence and the term in the sequence 3 before it: an = an−1 + an−3. Show using induction...
What is the MATLAB code used to solve the following equations? a. Express (2 + 3j)*(1-5j)*...
What is the MATLAB code used to solve the following equations? a. Express (2 + 3j)*(1-5j)* in recantgular form b. Express e^(-jpi/7) - pi/7 in recantgular form c. Express -2e^(-j90 degrees) in recantgular form d. Express 2 - sqrt-2 in polar form e. Find the magnitude of e^e^(2-j)
Please Write the whole program in assembly i am able to calculate the fibonacci series but...
Please Write the whole program in assembly i am able to calculate the fibonacci series but not sure how to print it in reverse order. Please give a Complete code !! Programming Exercise 1 (10 points): [call it Ass2-Q1.asm] Write an ASM program that reads an integer number N and then displays the first N values of the Fibonacci number sequence, described by: Fib(0) = 0, Fib(1) = 1, Fib(N) = Fib(N-2) + Fib(N-1) Thus, if the input is N...
Problem: Our Armstrong number Please write code for C language So far we have worked on...
Problem: Our Armstrong number Please write code for C language So far we have worked on obtaining individual digits from 4 digits or 5 digit numbers. Then added them to find the sum of digits in various examples and assignments. However, the process of extracting individual digits is actually can be solved using a loop as you were doing a repetitive task by using mod operation and division operation. Now, we know how loops work and we can remove the...
Problem 3 you can use Matlab and also i give u the Problem 1 code its...
Problem 3 you can use Matlab and also i give u the Problem 1 code its on Matlab Using the same initial code fragment as in Problem 1, add code that calculates and plays y (n)=h(n)?x (n) where h(n) is the impulse response of an IIR bandpass filter with band edge frequencies 750 Hz and 850 Hz and based on a 4th order Butterworth prototype. Name your program p3.sce this is the Problem 1 code and the solutin clear; clc;...
Please complete in MASM (x86 assembly language). Use the code below to get started. Write a...
Please complete in MASM (x86 assembly language). Use the code below to get started. Write a program that uses a loop to calculate the first seven values of the Fibonacci number sequence, described by the following formula: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n – 1) + Fib(n – 2). .386 .model flat,stdcall .stack 4096 ExitProcess PROTO,dwExitCode:DWORD .data    ; define your variables here .code main PROC    ; write your assembly code here    INVOKE ExitProcess,0 main...
Q1: Given the following code, what is returned by tq(4)? int tq(int num){ if (num ==...
Q1: Given the following code, what is returned by tq(4)? int tq(int num){ if (num == 0) return 0; else if (num > 100) return -1; else     return num + tq( num – 1 ); } Group of answer choices: 0 4 -1 10 Q2: Given that values is of type LLNode<Integer> and references a linked list (non-empty) of Integer objects, what does the following code do if invoked as mystery(values)? int mystery(LLNode<Integer> list) {    if (list.getLink() ==...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT