Matrix manipulation via for loop

5 vues (au cours des 30 derniers jours)
Nathaniel Fillman
Nathaniel Fillman le 8 Fév 2019
Modifié(e) : madhan ravi le 9 Fév 2019
The pressure matrix (p1) we were given is a 2d matrix 96 by 144. Here are the question instructions:
Use a for loop to convert the pressure in mb in the pressure array into pascals. Use the conversion given above to do so. Place the new data in a new pressure array called p1_pa. The array of p1_pa should be the same size as the p1 array. 1mb= 100Pa
Now, why they ask for a "for loop" instead of matrix multiplication (.*) I don't know. But when I'm working on this, I think the issue is the "for loop" isn't doing element by element operations, because it continuously overwrittes p1_pa, eventually spitting out just one scalar.
Thanks!
  1 commentaire
Stephen23
Stephen23 le 8 Fév 2019
Modifié(e) : Stephen23 le 8 Fév 2019
Basic MATLAB concepts, such as how to use indexing inside loops, are explained in the introductory tutorials:
These tutorials are highly recommended for all beginners. See also:

Connectez-vous pour commenter.

Réponses (1)

madhan ravi
madhan ravi le 8 Fév 2019
Modifié(e) : madhan ravi le 9 Fév 2019
Result(k)=... (k)- k denotes loop iterator , saves result in each iteration forming a vector in the end

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by