1 n=1:100;
2 k=0.5;
3 x[n]=sin((3*pi*n)/20);
4 y(n)=x(n./k);
5 scale (x,k);
I put line numbers for reference...
Line one is fine, creates a vector from 1 to 100.
Line two defines a scalar value k.
Line three, this is invalid, you can't use a vector as an index. You can either loop or simply remove the index reference.
x=sin((3*pi*n)/20); %valid
Line four, same thing... invalid because you're using a vector as an index. You also don't need the
./
operator when one is a vector and the other is a scalar, it doesn't make sense. Also, this n/k will give you non-integer values for some values of n, which is not a valid index.