How to get wrapped phase data from unwrapped phase data
47 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
采纳的回答
Star Strider
2021-7-22
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)
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)
figure
plot((1:size(P1,1)), wrapped)
grid
title('wrapToPi')
.
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!