plz send me the answer

Réponses (5)

Walter Roberson
Walter Roberson le 26 Mar 2012

0 votes

This is not possible in MATLAB, as MATLAB arrays cannot be indexed at negative numbers or 0, but you want to index y at -3, -2, -1, and 0, along with 1, 2, and 3.

1 commentaire

fadi rami
fadi rami le 26 Mar 2012
YES WALTER I MEAN " the value when x=1 is -3 and when x=2 the value is -2 etc , and i need for this shape make scaling and shifting
Geoff
Geoff le 26 Mar 2012

0 votes

I think you mean this:
x = -3:3;
y = 2 * x + 3;
plot(x, y);

3 commentaires

fadi rami
fadi rami le 26 Mar 2012
no man i mean " the value when x=1 is -3 and when x=2 the value is -2 etc , and i need for this shape make scaling and shifting
Geoff
Geoff le 26 Mar 2012
So you mean:
x = 1:7;
y = -3:3;
Here, y is "the value when x=1 is -3... etc", and you access it like this: y(1)
Geoff
Geoff le 26 Mar 2012
Alternatively, if you really did mean n = -3:3 and y = 2n + 3, then:
x = 1:7;
n = -3:3;
y = 2*n + 3;
Nourhan
Nourhan le 14 Août 2026 à 19:37
Modifié(e) : Nourhan le 14 Août 2026 à 20:58

0 votes

MATLAB does not allow negative or zero indices. MATLAB array indexing must start at 1
atta
atta il y a environ 18 heures
Modifié(e) : atta il y a environ 18 heures

0 votes

y[n]=x[2n+3]
with x=[1,2,3,4,5,6,7] and n=3:3.

This question is locked.

Catégories

En savoir plus sur Fractals dans Centre d'aide et File Exchange

Question posée :

le 26 Mar 2012

Locked: 

il y a environ 14 heures

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by