function in the matlab
2 ビュー (過去 30 日間)
古いコメントを表示
Hi every one
I have written following function:
Mohamed
2 件のコメント
Roger Stafford
2015 年 1 月 1 日
I should think it would be easy to write such a function. For the initial value of W you would use the Q(1) value as is, which means that W would necessarily initially fall between -pi and +pi. After that, if the absolute value of the difference between a Q value and the previous W value is greater than pi, then add or subtract whatever integral multiple of 2*pi to or from Q is required to make that absolute value be less than pi. The altered Q would then be the next W. This allows subsequent values of W to fall outside the -pi to +pi range in a manner depending on the sequence of Q values.
Out of curiosity, why would you wish to avoid matlab's 'unwrap' function, however? Is there some aspect of Mathworks' function that you wish to change, or is it that you simply like to experiment on your own?
Roger Stafford
2015 年 1 月 1 日
@Mohammadreza. Can you describe the particular way (aspect) in which your proposed 'unwrapp' would differ from Mathworks' 'unwrap'? Just consider that Q is an series of abstract numbers that all lie between -pi and +pi and forget about 'pipes' and 'noise'. Exactly what rules would you use to compute W from this sequence of Q values?
採用された回答
Roger Stafford
2015 年 1 月 1 日
If Q is a vector, I would suggest the following:
W = zeros(size(Q));
W(1) = Q(1);
for k = 2:length(Q)
W(k) = Q(k) + 2*pi*round((W(k-1)-Q(k))/(2*pi));
end
This ensures that successive values, W(k-1) and W(k), can differ in absolute value by no more than pi, and that W(k) will always be equal to Q(k) plus or minus an integral multiple of 2*pi.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Multirate Signal Processing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!