Do not use Matlab please show me the steps how to solve it b
Do not use Matlab, please show me the steps how to solve it by hand
Find the indices of the elements in the vector x=cos(0.5).^0.5*n) over 0 lessthanorequalto n lessthanorequalto 100 that lie between 0.45 and 0.65. y=[]; for k=1:length(x) if(x(k)>0.45 &&x;(k)Solution
first calculate the values for x
from n=0 to n=100
and store it in vector x
FOR EXAMPLE your vector x contains following values
x=[0 0.5 0.2 0.6 ]
as you can see 0.5 and 0.6 lies in range given. Their indexes are 2 and 4.This should be our output.
In order to simullate matlab code above and solving it using hand you will have to do following
declare a vector y[]
check every element of vector x[] and see if it lies in range given.
does 0 lies in range no
does 0.5 lies in range yes
does 0.2 lies in range no
does 0.6 lies in range yes
if yes
store that element in y[]
y[0.5 0.6]
now declare a vector n[]
for every element in y[] find the index of that element from vector x and store in n[]
find index of 0.5 in vector x[] i.e 2 and store it in n[]
find index of 0.6 in vector x[] i.e 4 and store it in n[]
dispalay the contents of n[]
i.e [2 4]
of course if you want to do by hand you can just look into vector x and figure out the index of elemnets in given range
