estimation matrix elements in a vector [message #94282] |
Sun, 26 March 2017 06:27  |
kghreep21
Messages: 7 Registered: March 2017
|
Junior Member |
|
|
Dear IDL Users,
I have a matrix like this
5.69 4.77 4.91
5.40 5.33 7.37
6.25 6.25 7.58
6.81 7.44 7.09
I would like to determine the above and the lower value of each elements in the following vector
b =[0.0,1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0,13. 0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25. 0,26.0,27.0,28.0,29.0,30.0]
and calculate (above value - lower value)/ ( above value - element value)
My regards
Khaled
|
|
|
|
|
|
|
Re: estimation matrix elements in a vector [message #94302 is a reply to message #94286] |
Sat, 01 April 2017 10:12   |
kghreep21
Messages: 7 Registered: March 2017
|
Junior Member |
|
|
On Monday, March 27, 2017 at 9:00:39 AM UTC+2, Yngvar Larsen wrote:
> On Sunday, 26 March 2017 23:59:26 UTC+2, kghr...@gmail.com wrote:
>> On Sunday, March 26, 2017 at 3:37:54 PM UTC+2, Yngvar Larsen wrote:
>>> https://www.harrisgeospatial.com/docs/VALUE_LOCATE.html
>>
>> Thanks Yngvar.
>> I am already solve my problem
>
> Good!
>
> As a courtesy to other readers, maybe you can post your code to solve this problem? This is a rather typical kind of IDL array juggling problem that others might be interested in.
>
> --
> Yngvar
Pro Inter_Data
; we have a measured wind speed as a string like this:
acutal_w= [ 5.5, 6.4, 8.9, 10.3, 8.2, 7.7, 6.8, 5.9, 5.4, 6.6, 6.1, 6.5]
In laboratory, we have measured a wind power Coor_P corresponding to laboratory wind speed w_t
w_t =[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,2 1.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0]
coor_P=[0.00,0.00,0.00,5.00,25.00,60.00,118.00,154.00,269.00 ,411.00,538.00,600.00,600.00,$
600.00,600.00,600.00,600.00,600.00,600.00,600.00,600.00,600. 00,600.00,600.00,600.00,600.00,0.00,0.00,0.00,0.00,0.00]
; we would like to estimate a wind power corresponding a measured wind speed ;acutal_w. first, we have locate value of acutal_w in W_t via Value_locate ;function
R = VALUE_LOCATE ( w_t ,acutal_w, /L64 )
; the estimated wind power as function in acutal_w, W_t and coor_P as follows:-
pow_est=dblarr(n_elements(r))
for j = 0, n_elements(r)-1 do begin
pow_est(j) = coor_P (r(j)+1) - ( coor_P(r (j) + 1) - coor_P(r(j) ) ) * ( ( w_t ( r(j)+1) - acutal_w( j) ) / ( w_t (r(j)+1)- w_t(r(j) ) ) )
endfor
print, pow_est, format=' (12(F9.2,3x))'
end
|
|
|
Re: estimation matrix elements in a vector [message #94304 is a reply to message #94302] |
Mon, 03 April 2017 02:46  |
Markus Schmassmann
Messages: 129 Registered: April 2016
|
Senior Member |
|
|
On 04/01/2017 07:12 PM, kghreep21@gmail.com wrote:
> On Monday, March 27, 2017 at 9:00:39 AM UTC+2, Yngvar Larsen wrote:
>> On Sunday, 26 March 2017 23:59:26 UTC+2, kghr...@gmail.com wrote:
>>> On Sunday, March 26, 2017 at 3:37:54 PM UTC+2, Yngvar Larsen wrote:
>>>> https://www.harrisgeospatial.com/docs/VALUE_LOCATE.html
>>> Thanks Yngvar.
>>> I am already solve my problem
>> Good!
>>
>> As a courtesy to other readers, maybe you can post your code to solve this problem? This is a rather typical kind of IDL array juggling problem that others might be interested in.
>
> Pro Inter_Data
>
> ; we have a measured wind speed as a string like this:
> acutal_w= [ 5.5, 6.4, 8.9, 10.3, 8.2, 7.7, 6.8, 5.9, 5.4, 6.6, 6.1, 6.5]
>
> In laboratory, we have measured a wind power Coor_P corresponding to laboratory wind speed w_t
>
> w_t =[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0,10.0,11.0,12.0,13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,2 1.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0]
>
> coor_P=[0.00,0.00,0.00,5.00,25.00,60.00,118.00,154.00,269.00 ,411.00,538.00,600.00,600.00,$
> 600.00,600.00,600.00,600.00,600.00,600.00,600.00,600.00,600. 00,600.00,600.00,600.00,600.00,0.00,0.00,0.00,0.00,0.00]
> ; we would like to estimate a wind power corresponding a measured wind speed ;acutal_w. first, we have locate value of acutal_w in W_t via Value_locate ;function
>
> R = VALUE_LOCATE ( w_t ,acutal_w, /L64 )
>
> ; the estimated wind power as function in acutal_w, W_t and coor_P as follows:-
>
> pow_est=dblarr(n_elements(r))
>
> for j = 0, n_elements(r)-1 do begin
>
> pow_est(j) = coor_P (r(j)+1) - ( coor_P(r (j) + 1) - coor_P(r(j) ) ) * ( ( w_t ( r(j)+1) - acutal_w( j) ) / ( w_t (r(j)+1)- w_t(r(j) ) ) )
>
> endfor
>
>
>
> print, pow_est, format=' (12(F9.2,3x))'
>
> end
>
you can also use the INTERPOL function:
pow_est=interpol(coor_P,w_t,acutal_W)
see:
http://www.harrisgeospatial.com/docs/INTERPOL.html
|
|
|