How do I use multiple matrices?
Afficher commentaires plus anciens
I have an array of temperatures that start from 0 and go to 50. The array goes in increments of 10. So I have declared,
T=0:10:50
I have another array which are the relative humidity’s that goes from 10 to 100. I have this set to go in increments of 10.
RH=10:10:100
If I want to find the dew point at each temperature, I have to consider each of the following relative humidity’s too. How do I incorporate each element of the temperature array with each element of the relative humidity array in the equation? Dewpoint =
DewpointT= T -(100-RH/5)
. I thought I would use meshgrid, but I was getting negative values.
Réponses (1)
DewpointT= T(:) - (100-RH/5)
3 commentaires
Monica Padykula
le 1 Avr 2021
That is correct, given the formula you stated. When T is 0 and RH is 10:
T = 0;
RH = 10;
D = T - (100-RH/5)
Even if you meant to divide (100-RH) by 5 rather than subtracting RH/5 from 100, it's still negative. In this case you're still subtracting something positive from 0 and that's going to give you a negative value.
D = T - (100-RH)/5
Matt J
le 1 Avr 2021
If you need to keep only non-negative values, do
DewpointT(DewpointT<0)=[];
or
DewpointT(DewpointT<0)=nan;
Catégories
En savoir plus sur Image Processing Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!