Question

given a size N, create a row vector x= [x1,x2,....,xN] which contains the first N terms...

given a size N, create a row vector x= [x1,x2,....,xN] which contains the first N terms of the below sequence:

x1=2
xi+1=3-xi
you must use a for loop to generate the elements in x.
this is done in MATLAB

MATLAB Code:

clear all;
clc;
x(1)=2;
ii=1;
N=input('Number of terms Required');
for tt=1:1:N
x(ii+1)= 3 - x(ii);
ii=ii+1;
end

Result:

Number of terms Required 5
>> x

x =

2 1 2 1 2 1

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
• Let X = x1, x2, . . . , xn be a sequence of n integers....

Let X = x1, x2, . . . , xn be a sequence of n integers. A sub-sequence of X is a sequence obtained from X by deleting some elements. Give an O(n2) algorithm to find the longest monotonically increasing sub-sequences of X.

• Please answer question (a) X1 - X X2 – Å a. Let X1, ..., Xn i.i.d....

Please answer question (a) X1 - X X2 – Å a. Let X1, ..., Xn i.i.d. random variables with X; ~ N(u, o). Express the vector in the | Xn – form AX and find its mean and variance covariance matrix. Show some typical elements of the vari- ance covariance matrix. b. Refer to question (a). The sample variance is given by S2 = n11 21–1(X; – X)2, which can be ex- pressed as S2 = n1X'(I – 111')X (why?)....

• Consider The problem of determining whether an arbitrary sequence [x1,x2,...,xn] of n numbers contains repeated occurrences...

Consider The problem of determining whether an arbitrary sequence [x1,x2,...,xn] of n numbers contains repeated occurrences of some number. Show that this can be done in O(nlogn) time.

• Let X1, X2, ...,Xn denote a random sample of size n from a Pareto distribution. X(1)...

Let X1, X2, ...,Xn denote a random sample of size n from a Pareto distribution. X(1) = min(X1, X2, ..., Xn) has the cumulative distribution function given by: αη 1 - ( r> B X F(x) = . x <B 0 Show that X(1) is a consistent estimator of ß.

• 7.2.6. Let X1, X2....Xn be a random sample of size n from a beta d with...

7.2.6. Let X1, X2....Xn be a random sample of size n from a beta d with parameters α-θ and β statistic for θ 5. Show tha the product Xi X2 . . . Xn is a sufficient oherat tious is a sufficient statistic for

• 1. Let X1, X2,... .Xn be a random sample of size n from a Bernoulli distribution...

1. Let X1, X2,... .Xn be a random sample of size n from a Bernoulli distribution for which p is the probability of success. We know the maximum likelihood estimator for p is p = 1 Σ_i Xi. ·Show that p is an unbiased estimator of p.

• Let X1, X2, ..., Xn be a random sample of size n from a population that...

Let X1, X2, ..., Xn be a random sample of size n from a population that can be modeled by the following probability model: axa-1 fx(x) = 0 < x < 0, a > 0 θα a) Find the probability density function of X(n) max(X1,X2, ...,Xn). b) Is X(n) an unbiased estimator for e? If not, suggest a function of X(n) that is an unbiased estimator for e.

• Let X1, X2, ..., Xn denote a random sample of size n from a population whose...

Let X1, X2, ..., Xn denote a random sample of size n from a population whose density fucntion is given by 383x-4 f S x f(x) = 0 elsewhere where ß > 0 is unknown. Consider the estimator ß = min(X1, X2, ...,Xn). Derive the bias of the estimator ß.

• Let X1, X2, ... , Xn be a random sample of size n from the exponential...

Let X1, X2, ... , Xn be a random sample of size n from the exponential distribution whose pdf is f(x; θ) = (1/θ)e^(−x/θ) , 0 < x < ∞, 0 <θ< ∞. Find the MVUE for θ. Let X1, X2, ... , Xn be a random sample of size n from the exponential distribution whose pdf is f(x; θ) = θe^(−θx) , 0 < x < ∞, 0 <θ< ∞. Find the MVUE for θ.

• given a row vector x create each of the following row vectors as indicated y is...

given a row vector x create each of the following row vectors as indicated y is two copies of x, one after another (a vector twice as large as x, containing two copies) z is a vector containing the elements of x with odd indices w is identical to x, except it contains the number 0 inserted before the first element of x, a 7 inserted after the fourth element of x, and 12 inserted after the last element of...