How to get wrapped phase data from unwrapped phase data

47 visualizaciones (últimos 30 días)
Tina Hsiao
Tina Hsiao el 22 de Jul. de 2021
Comentada: Star Strider el 22 de Jul. de 2021
Hello, I have a unwrapped phase data (like figure c)), and would like to converter to wapped phase -pi to pi (figure d)). The unwrapped data as below,
clear all
close all
x = [0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300;
0 25 50 75 100 125 150 175 200 225 250 275 300];
y = [0 0 0 0 0 0 0 0 0 0 0 0 0;
25 25 25 25 25 25 25 25 25 25 25 25 25;
50 50 50 50 50 50 50 50 50 50 50 50 50;
75 75 75 75 75 75 75 75 75 75 75 75 75;
100 100 100 100 100 100 100 100 100 100 100 100 100;
125 125 125 125 125 125 125 125 125 125 125 125 125;
150 150 150 150 150 150 150 150 150 150 150 150 150;
175 175 175 175 175 175 175 175 175 175 175 175 175;
200 200 200 200 200 200 200 200 200 200 200 200 200;
225 225 225 225 225 225 225 225 225 225 225 225 225;
250 250 250 250 250 250 250 250 250 250 250 250 250;
275 275 275 275 275 275 275 275 275 275 275 275 275;
300 300 300 300 300 300 300 300 300 300 300 300 300];
P1 = [0.00629902465548593 0 0.370360403979544 0.697952300768709 1.09498976198938 1.56870800849013 2.12395906570559 2.81585532372079 3.39866169304573 3.64253589553491 4.26484759295528 4.83926438355056 4.98002974456558;
0.137381160979757 0.246608475310334 0.592860021968966 0.796909269134396 1.17006024381228 1.61722777123652 2.09098133689549 2.49798333473697 3.27627600697244 3.76528436339437 4.27393969223159 4.69233205784296 4.82449188605027;
0.283802206311021 0.379244486555537 0.636863031608359 0.894743014026747 1.32245034405842 1.76881078704342 2.22803397844447 2.88148743448661 3.48150531224602 3.86924267707491 4.33418741403774 4.75077070610127 5.00893907178119;
0.521196529741695 0.534390705876809 0.920249592084803 1.05001285542764 1.66533802386529 2.09312319089403 2.32781805966794 2.94214425179044 3.48540934510910 3.94159355749976 4.44480140586060 4.92395859232093 5.20553404005533;
0.930727793725104 1.00047800959736 1.19722667041764 1.44486409206520 1.90284091792818 2.29410161862994 2.70298917461811 3.19572251117720 3.66103111577096 4.01087501806143 4.57994821896516 5.24967348809286 5.45832605077326;
1.45432174020560 1.52165971306495 1.65779975241850 1.85155102351230 2.41122947846562 2.65820594154887 3.14661217993624 3.59598633141906 4.03429414470343 4.40257738423707 5.11279339119620 5.48946170408643 5.72329126786549;
2.09243861721516 2.15418697359138 2.29137619939394 2.61066961130222 2.93275370878592 3.45800370014039 3.77806691806529 4.12323508596284 4.55659505933522 4.99103488622617 5.47479588652139 5.82258900961291 6.06276261255363;
2.84828226959355 2.88904349573765 2.96873285191344 3.08069203738026 3.44697966788091 4.13567533931369 4.52894098819945 4.67412567995202 5.15296324526301 5.56523852795320 5.96502602345583 6.21078028605879 6.52849691526073;
3.74002027926708 3.75993225502666 3.83411382444209 4.00456816843311 4.32926896155507 4.77622144003005 5.16736759461981 5.49836937572280 5.88647170837687 6.18271839080470 6.59759022678129 6.97084214072058 6.75170686464779;
4.78524857165206 4.74826975259759 4.81706589206119 4.97601956899259 5.27355150638661 5.63396907113975 5.99958011195912 6.36694810730541 6.77714174291766 6.70742436573057 7.25550718842670 7.26295700795507 7.25746708897833;
6.03717083993188 5.79887631698666 5.91639397495982 6.00350593883982 6.33213672950170 6.64106263587169 6.95706983158674 7.28782367961083 7.70705369497867 7.63458594897408 7.93261292601932 8.00295469770043 7.82960635002508;
7.19298190970422 7.15760814782713 7.24449095049573 7.47603016525217 7.57972831981689 7.78795195979569 8.01946233620746 8.20828974079021 8.68131635353786 8.70525487083782 8.81017351195784 8.91630723595258 8.87870649490453;
8.54520636494540 8.55348201216040 8.61726432100011 8.75404753128375 8.88337889302489 9.04996267034075 9.23602519155018 9.42482470685441 9.64993914996010 9.70203369491229 9.65289346191122 9.39722499724188 9.12721227719753];
figure(2)
pcolor(x,y,P1)
axis square,
shading interp
colorbar
colormap((gray(256)));
set(gca,'xtick',[])
set(gca,'ytick',[])
set(gca,'FontSize',14)

Respuesta aceptada

Star Strider
Star Strider el 22 de Jul. de 2021
According to the unwrap documentation, unwrapping takes the original and adds radians to phase angles that originally go from .
Unwrapped:
P1 = [0.00629902465548593 0 0.370360403979544 0.697952300768709 1.09498976198938 1.56870800849013 2.12395906570559 2.81585532372079 3.39866169304573 3.64253589553491 4.26484759295528 4.83926438355056 4.98002974456558;
0.137381160979757 0.246608475310334 0.592860021968966 0.796909269134396 1.17006024381228 1.61722777123652 2.09098133689549 2.49798333473697 3.27627600697244 3.76528436339437 4.27393969223159 4.69233205784296 4.82449188605027;
0.283802206311021 0.379244486555537 0.636863031608359 0.894743014026747 1.32245034405842 1.76881078704342 2.22803397844447 2.88148743448661 3.48150531224602 3.86924267707491 4.33418741403774 4.75077070610127 5.00893907178119;
0.521196529741695 0.534390705876809 0.920249592084803 1.05001285542764 1.66533802386529 2.09312319089403 2.32781805966794 2.94214425179044 3.48540934510910 3.94159355749976 4.44480140586060 4.92395859232093 5.20553404005533;
0.930727793725104 1.00047800959736 1.19722667041764 1.44486409206520 1.90284091792818 2.29410161862994 2.70298917461811 3.19572251117720 3.66103111577096 4.01087501806143 4.57994821896516 5.24967348809286 5.45832605077326;
1.45432174020560 1.52165971306495 1.65779975241850 1.85155102351230 2.41122947846562 2.65820594154887 3.14661217993624 3.59598633141906 4.03429414470343 4.40257738423707 5.11279339119620 5.48946170408643 5.72329126786549;
2.09243861721516 2.15418697359138 2.29137619939394 2.61066961130222 2.93275370878592 3.45800370014039 3.77806691806529 4.12323508596284 4.55659505933522 4.99103488622617 5.47479588652139 5.82258900961291 6.06276261255363;
2.84828226959355 2.88904349573765 2.96873285191344 3.08069203738026 3.44697966788091 4.13567533931369 4.52894098819945 4.67412567995202 5.15296324526301 5.56523852795320 5.96502602345583 6.21078028605879 6.52849691526073;
3.74002027926708 3.75993225502666 3.83411382444209 4.00456816843311 4.32926896155507 4.77622144003005 5.16736759461981 5.49836937572280 5.88647170837687 6.18271839080470 6.59759022678129 6.97084214072058 6.75170686464779;
4.78524857165206 4.74826975259759 4.81706589206119 4.97601956899259 5.27355150638661 5.63396907113975 5.99958011195912 6.36694810730541 6.77714174291766 6.70742436573057 7.25550718842670 7.26295700795507 7.25746708897833;
6.03717083993188 5.79887631698666 5.91639397495982 6.00350593883982 6.33213672950170 6.64106263587169 6.95706983158674 7.28782367961083 7.70705369497867 7.63458594897408 7.93261292601932 8.00295469770043 7.82960635002508;
7.19298190970422 7.15760814782713 7.24449095049573 7.47603016525217 7.57972831981689 7.78795195979569 8.01946233620746 8.20828974079021 8.68131635353786 8.70525487083782 8.81017351195784 8.91630723595258 8.87870649490453;
8.54520636494540 8.55348201216040 8.61726432100011 8.75404753128375 8.88337889302489 9.04996267034075 9.23602519155018 9.42482470685441 9.64993914996010 9.70203369491229 9.65289346191122 9.39722499724188 9.12721227719753];
figure
plot((1:size(P1,1)), P1)
grid
title('Original Unwrapped')
Wrapped:
mf = mod(P1,2*pi);
wP1 = mf.*(mf<=pi) + (mf-2*pi).*(mf>pi)
wP1 = 13×13
0.0063 0 0.3704 0.6980 1.0950 1.5687 2.1240 2.8159 -2.8845 -2.6406 -2.0183 -1.4439 -1.3032 0.1374 0.2466 0.5929 0.7969 1.1701 1.6172 2.0910 2.4980 -3.0069 -2.5179 -2.0092 -1.5909 -1.4587 0.2838 0.3792 0.6369 0.8947 1.3225 1.7688 2.2280 2.8815 -2.8017 -2.4139 -1.9490 -1.5324 -1.2742 0.5212 0.5344 0.9202 1.0500 1.6653 2.0931 2.3278 2.9421 -2.7978 -2.3416 -1.8384 -1.3592 -1.0777 0.9307 1.0005 1.1972 1.4449 1.9028 2.2941 2.7030 -3.0875 -2.6222 -2.2723 -1.7032 -1.0335 -0.8249 1.4543 1.5217 1.6578 1.8516 2.4112 2.6582 -3.1366 -2.6872 -2.2489 -1.8806 -1.1704 -0.7937 -0.5599 2.0924 2.1542 2.2914 2.6107 2.9328 -2.8252 -2.5051 -2.1600 -1.7266 -1.2922 -0.8084 -0.4606 -0.2204 2.8483 2.8890 2.9687 3.0807 -2.8362 -2.1475 -1.7542 -1.6091 -1.1302 -0.7179 -0.3182 -0.0724 0.2453 -2.5432 -2.5233 -2.4491 -2.2786 -1.9539 -1.5070 -1.1158 -0.7848 -0.3967 -0.1005 0.3144 0.6877 0.4685 -1.4979 -1.5349 -1.4661 -1.3072 -1.0096 -0.6492 -0.2836 0.0838 0.4940 0.4242 0.9723 0.9798 0.9743
plot((1:size(P1,1)), wP1)
grid
title('Wrapped')
The Mapping Toolbox has the wrapToPi function, and while I do not have it, the online Run feature dees, and it produces:
wrapped = wrapToPi(P1)
wrapped = 13×13
0.0063 0 0.3704 0.6980 1.0950 1.5687 2.1240 2.8159 -2.8845 -2.6406 -2.0183 -1.4439 -1.3032 0.1374 0.2466 0.5929 0.7969 1.1701 1.6172 2.0910 2.4980 -3.0069 -2.5179 -2.0092 -1.5909 -1.4587 0.2838 0.3792 0.6369 0.8947 1.3225 1.7688 2.2280 2.8815 -2.8017 -2.4139 -1.9490 -1.5324 -1.2742 0.5212 0.5344 0.9202 1.0500 1.6653 2.0931 2.3278 2.9421 -2.7978 -2.3416 -1.8384 -1.3592 -1.0777 0.9307 1.0005 1.1972 1.4449 1.9028 2.2941 2.7030 -3.0875 -2.6222 -2.2723 -1.7032 -1.0335 -0.8249 1.4543 1.5217 1.6578 1.8516 2.4112 2.6582 -3.1366 -2.6872 -2.2489 -1.8806 -1.1704 -0.7937 -0.5599 2.0924 2.1542 2.2914 2.6107 2.9328 -2.8252 -2.5051 -2.1600 -1.7266 -1.2922 -0.8084 -0.4606 -0.2204 2.8483 2.8890 2.9687 3.0807 -2.8362 -2.1475 -1.7542 -1.6091 -1.1302 -0.7179 -0.3182 -0.0724 0.2453 -2.5432 -2.5233 -2.4491 -2.2786 -1.9539 -1.5070 -1.1158 -0.7848 -0.3967 -0.1005 0.3144 0.6877 0.4685 -1.4979 -1.5349 -1.4661 -1.3072 -1.0096 -0.6492 -0.2836 0.0838 0.4940 0.4242 0.9723 0.9798 0.9743
figure
plot((1:size(P1,1)), wrapped)
grid
title('wrapToPi')
.

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by