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
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)
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...
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...
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() ==...
Use Matlab to calculate the probabilities in the following scenarios. Provide your code as well as...
Use Matlab to calculate the probabilities in the following scenarios. Provide your code as well as your answer. Hint: You will find the following Matlab functions useful: normcdf(), normrnd() (a) IQ tests are designed in such a way that the mean and standard deviation are equal to 100 and 15 respectively. What is the probability of having an IQ score of 130 or more? (b) What is the probability of having an IQ between 110 and 130? (c) Bolts for...
1. Write a MATLAB function to determine the discrete-time Fourier Transform (H(?)) of the following sequence....
1. Write a MATLAB function to determine the discrete-time Fourier Transform (H(?)) of the following sequence. Plot its magnitude and phase. You can use the dtft command and use the abs, angle and plot commands to plot the results. x(n) = {4, 3, 2, 1, 2, 3, 4}. 2. Analytically determine H(z) and plot its magnitude and phase for the following system using freqz. y(n) = 2x(n) + x(n ? 1) ? 0.25y(n ? 1) + 0.25y(n ? 2). 3....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT