(Vector initialization) Use oneMATLAB statement to initialize the following vect
ID: 2253674 • Letter: #
Question
(Vector initialization) Use oneMATLAB statement to initialize the following vectors. You can include allthe statements in one m-file and test your result by taking n=5 at the beginning. In your assignment, you don’t need to include the output. All we need is your m-file.
a.) e=(2,3,4,5,...,n^2,999999)^T
b.) The vector f in R^n where f= (sin2,sin5,sin8,...,sin(-1+3n))^T
c.) g= (sin1,sin2,sin3,...,sin(n),cos(n),cos(n-1),...,cos2,cos1)^T
d.) u= (2/5,3/7,4/9,5/11,6/13,...)^T in R^n
e.)c= [1/(sin(n^3)),1/(sin(n-1)^3),1/(sin(n-2)^3),...,1/(sin(1^3))]^T
f.)d=[1/sin^3(n),1/sin^3(n-1),1/sin^3(n-2),...,1/sin^3(1)]^T
g.)f=(1!,2!,3!,...,(n+1)!)^T
Explanation / Answer
a)
e=2:25 will create vector e with elements (2,3,4........25) since we assume n=5
e=2:n^2 will create vectors from 2 till n^2.
b)
n=is the integer which we have assumed to b 5
Let x=(-1+3n)
for a=2:x
f= sin(a)
will create vector f with vectors (sin2,sin5,.....sin(-1+3n))
c)
for n=1:5
g=sin(n):cos(n-1)
The resulting vector will g =(sin 1,sin2,sin3,sin4,sin5,cos4,cos3,cos2,cos1)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.