squaring values in a matrix

5 vues (au cours des 30 derniers jours)
Trey  Godfrey
Trey Godfrey le 6 Avr 2022
Commenté : Trey Godfrey le 6 Avr 2022
how would i get the squares of numbers counting from 1 to 100
  2 commentaires
Rik
Rik le 6 Avr 2022
This sounds like homework. What did you try so far?
Trey  Godfrey
Trey Godfrey le 6 Avr 2022
So the problem is creating a matrix with 3x100. The first row must go from 3 to 203 in even increments( i figured out how to get that statement using a=3:2:203), the second row is supposed to be 100 zeros, i figured out how to do that. (used a2=zeroes(1,100)) now the third row is getting squares of numbers 1 to 100. I've tried testing using just 1 to 10 using things like a=1:1:10 & b= a^2. Ive also used a= 1:1^2:100. honestly I'm very new to this sort of stuff and am struggling

Connectez-vous pour commenter.

Réponses (1)

David Hill
David Hill le 6 Avr 2022
[(3:2:201);zeros(1,100);(1:100).^2];
  1 commentaire
Trey  Godfrey
Trey Godfrey le 6 Avr 2022
thank you so much

Connectez-vous pour commenter.

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by