how i can select an indice in vector and matrix
Show older comments
Hello guys i have a problem to select an indice in matlab for ex: i have this programme:
T=[0 10 20 30 40 50]; % température en°C
phi=[0 20 40 60 80 100]; % Humidité relative en %
Cs =
0.2685 0.3110 0.3501 0.3857 0.4192 0.4528
0.2691 0.3079 0.3449 0.3785 0.4093 0.4368
0.2690 0.3048 0.3394 0.3708 0.3991 0.4229
0.2688 0.3025 0.3345 0.3635 0.3893 0.4107
0.2692 0.3016 0.3313 0.3576 0.3806 0.3999
0.2709 0.3031 0.3309 0.3538 0.3738 0.3900
we can imagine this like that
0 10 20 30 40 50
0 0.2685 0.3110 0.3501 0.3857 0.4192 0.4528
20 0.2691 0.3079 0.3449 0.3785 0.4093 0.4368
40 0.2690 0.3048 0.3394 0.3708 0.3991 0.4229
60 0.2688 0.3025 0.3345 0.3635 0.3893 0.4107
80 0.2692 0.3016 0.3313 0.3576 0.3806 0.3999
100 0.2709 0.3031 0.3309 0.3538 0.3738 0.3900
so i want to when i input temperature and humidity the programme select the Cs's value
for ex: if i do that
tx=input('chose your température plz')
phix=input('chose your humidity plz')
and i chose tx=10 & phix=20 the result will be
Csx=0.3079
i hope i explained my problem and i'm waiting your answers
Accepted Answer
More Answers (3)
ilyas ilyas
on 26 Apr 2013
0 votes
ilyas ilyas
on 26 Apr 2013
Edited: ilyas ilyas
on 16 May 2013
0 votes
3 Comments
Cedric
on 27 Apr 2013
This is essentially what INTERP2 does in my comment above, so there is little interest in re-implementing it by yourself (unless it is for a homework and you have to implement it by yourself).
So try using INTERP2; look up for examples in the official documentation and/or online if you need more than my example.
ilyas ilyas
on 27 Apr 2013
Cedric
on 27 Apr 2013
At what point did you make the test and what/how did you compute.
The issue if you really want to implement your formula by hand is that you will have to manage quite a few special cases, which means that you will have to implement more code that just the formula that you have above.
ilyas ilyas
on 27 Apr 2013
Edited: ilyas ilyas
on 16 May 2013
0 votes
1 Comment
Cedric
on 28 Apr 2013
Ok, great if you found a solution; bonne continuation !
Categories
Find more on Simscape Multibody in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!