How do I use multiple matrices?
이전 댓글 표시
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.
답변 (1개)
DewpointT= T(:) - (100-RH/5)
댓글 수: 3
Monica Padykula
2021년 4월 1일
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
2021년 4월 1일
If you need to keep only non-negative values, do
DewpointT(DewpointT<0)=[];
or
DewpointT(DewpointT<0)=nan;
카테고리
도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!