Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HI all

6 views
Skip to first unread message

fadi rami

unread,
Mar 25, 2012, 8:28:14 PM3/25/12
to
x=1:7
n=-3:3
need y[n]=x[2n+3] ?

ImageAnalyst

unread,
Mar 25, 2012, 8:51:41 PM3/25/12
to
-------------------------------------------------------
So you say that y is a function of n ONLY, not of x. So what x value
are you going to use in that equation? Let's say it's x=4. Then you
just do

yn = x * (2*n+3)

n is an array, x is a scalar so yn will be an array where the values
of yn depend on the variable n, and the constant x, like you
specified.

If x is supposed to be a variable then y will be a function of both x
AND n so you can do that easily with 2 nested for loops, one over x
and one over n and the calculation of yxn inside. Let us know if
that's what you REALLY want to do and if you can't figure it out.

Steven_Lord

unread,
Mar 26, 2012, 9:35:07 AM3/26/12
to


"fadi rami" <fadir...@yahoo.com> wrote in message
news:jkod6u$d4o$1...@newscl01ah.mathworks.com...
> x=1:7
> n=-3:3
> need y[n]=x[2n+3] ?

There's no such thing as the -3rd element of a matrix in MATLAB, and x does
not have a ninth element but computing y[3] would require x[2*3+3] = x[9].

If you would like some help, you're going to need to explain exactly what it
is you're trying to do and show the group what you've already tried (so we
don't reinvent a wheel that has already proved not to work for you.)

--
Steve Lord
sl...@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

0 new messages