Info

This question is closed. Reopen it to edit or answer.

using one ratio value,how to search values which are the same in magnitude in one arry,and the same posion in the thrid arry?

1 view (last 30 days)
I have two raw vectors m and n of equal length 10.The user feeds two raw vectors h and t of unknown length.My code use the ratio of h to t(let say h./t=k) and searches if there is an equal value in n which is the same as k .If it finds the value in n,which is =k,it should use the value m which corresponds in the same position in n.
eg m=[0.1406 0.166 0.196 0.229 0.249 0.263 0.281 0.291 0.312]; n=[1.0 1.2 1.5 2.0 2.5 3 4 5 10 ]; h= [ 2a b c a 3b] t= [a l 1 b]
k=h./t =[2 b c 3]
then k= 2 and 3 are found in n.The values in m which are corresponding to 2.0 and 3 will be used that are(m(4) and m(6)index 4 and 6 are needed since they are the same for n an m for my code. Help me guys as usual how can i write the code?It may simple for you,but it confused me.
Is there any way I can use the same index for more than two vectors
eg J=k(i).*h(i).*t(i).^3 is it possible?

Answers (0)

Community Treasure Hunt

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

Start Hunting!