Borrar filtros
Borrar filtros

Alternative function to pwelch() and different results

9 visualizaciones (últimos 30 días)
marcusbarnet
marcusbarnet el 22 de Mayo de 2018
Comentada: marcusbarnet el 22 de Mayo de 2018
I use the pwelch() function from the DSP Toolbox in Matlab R2017a to calculate the power spectral density of a given vector. It works very nice, but now I need to run my code on a Matlab installation which do not have the DSP Toolbox so I need to find an alternative function.
I've found this function with source code: pwelch from Octave which runs on Matlab without problems.
The only this is that the pwelch function from DSP Toolbox returns an output vector which is different from the pwelch from Octave since it has a different size and also different values.
Can you please help me to find a solution to my problem? I already looked on Matlab file exchange but I wasn't able to find a similar function.
This is the original vector:
I_sx(570:970)
ans =
-27.3980
-27.3590
-27.2351
-27.0177
-26.9524
-26.7875
-26.6448
-26.5835
-26.5095
-26.4065
-26.5041
-26.5189
-26.4785
-26.5424
-26.5155
-26.3964
-26.4139
-26.3351
-26.3405
-26.3903
-26.3775
-26.3405
-26.3445
-26.2617
-26.2032
-26.1924
-26.2631
-26.2025
-26.2658
-26.2678
-26.2375
-26.2321
-26.2429
-26.1365
-26.1210
-26.0638
-26.0497
-26.1244
-26.1426
-26.0477
-26.0672
-26.0840
-26.0820
-26.0712
-26.1385
-26.0726
-26.1843
-26.2133
-26.2826
-26.3587
-26.4253
-26.3452
-26.4031
-26.3836
-26.3910
-26.4354
-26.4092
-26.3142
-26.3284
-26.2456
-26.1412
-26.0860
-26.1163
-26.0645
-26.1069
-26.1332
-26.1527
-26.1136
-26.1722
-26.0382
-26.0261
-26.0255
-26.0012
-25.9177
-25.9965
-25.9379
-25.9662
-25.9177
-25.8625
-25.8430
-25.8969
-25.8282
-25.8390
-25.8612
-25.8625
-25.8592
-25.9090
-25.7750
-25.7831
-25.7420
-25.7017
-25.6983
-25.7447
-25.6478
-25.5798
-25.5340
-25.4384
-25.4526
-25.4640
-25.4095
-25.3274
-25.3772
-25.4526
-25.4452
-25.5159
-25.4533
-25.4263
-25.4829
-25.5219
-25.5717
-25.6916
-25.7252
-25.6922
-25.7414
-25.7501
-25.6801
-25.7070
-25.6417
-25.6290
-25.6996
-25.6996
-25.6909
-25.7407
-25.6323
-25.5623
-25.5872
-25.5616
-25.6040
-25.6929
-25.6619
-25.6579
-25.7077
-25.6835
-25.6727
-25.7892
-25.8706
-25.8679
-25.9925
-26.0685
-26.1433
-26.2550
-26.3116
-26.2698
-26.2617
-26.2240
-26.2173
-26.2678
-26.3910
-26.2900
-26.2725
-26.2739
-26.3028
-26.3439
-26.4415
-26.4112
-26.4751
-26.5532
-26.5613
-26.6461
-26.6502
-26.6239
-26.6286
-26.6367
-26.6946
-26.7606
-26.8245
-26.7821
-26.7942
-26.7639
-26.7410
-26.7511
-26.7801
-26.7229
-26.7390
-26.7249
-26.6683
-26.6259
-26.6461
-26.5337
-26.4960
-26.4610
-26.4644
-26.4671
-26.5620
-26.4920
-26.4920
-26.4018
-26.3735
-26.2402
-26.3095
-26.2739
-26.2052
-26.1608
-26.1325
-26.0719
-26.0914
-26.0228
-26.0483
-26.0732
-26.0840
-26.0840
-26.1372
-26.1318
-26.1554
-26.0968
-26.1096
-26.0813
-26.2025
-26.1944
-26.2072
-26.2658
-26.2813
-26.2584
-26.2873
-26.2065
-26.2187
-26.2388
-26.2866
-26.2860
-26.3822
-26.3896
-26.4159
-26.3843
-26.3661
-26.3176
-26.3721
-26.3210
-26.3923
-26.4596
-26.4724
-26.4637
-26.5155
-26.4496
-26.4623
-26.4267
-26.4341
-26.4206
-26.4226
-26.2880
-26.2267
-26.1325
-26.0867
-25.9884
-26.0154
-25.9534
-25.9541
-25.9400
-25.9352
-25.8592
-25.8996
-25.8174
-25.7999
-25.7596
-25.7878
-25.7771
-25.8040
-25.7528
-25.7151
-25.6512
-25.5616
-25.4708
-25.4694
-25.3530
-25.3280
-25.3240
-25.3388
-25.3583
-25.4203
-25.3395
-25.3213
-25.3153
-25.3381
-25.3045
-25.3065
-25.2311
-25.2506
-25.1524
-25.0972
-25.1497
-25.2998
-25.3597
-25.4755
-25.5515
-25.6518
-25.6868
-25.7313
-25.7165
-25.8195
-25.8403
-25.9218
-25.9346
-26.0928
-26.0308
-26.1372
-26.1345
-26.1695
-26.2301
-26.3216
-26.3304
-26.4583
-26.5431
-26.6320
-26.6576
-26.7794
-26.8009
-26.8723
-26.8770
-26.9315
-26.9214
-26.9753
-26.9181
-26.9376
-26.8131
-26.7599
-26.8178
-26.9376
-26.9571
-27.0534
-27.0998
-27.1362
-27.0992
-27.0897
-26.9834
-27.0157
-26.9430
-26.9686
-26.9807
-27.0318
-26.9396
-26.9665
-26.8434
-26.7760
-26.6764
-26.7309
-26.6333
-26.6838
-26.6589
-26.7121
-26.7202
-26.7525
-26.6441
-26.6333
-26.5835
-26.6461
-26.6077
-26.5896
-26.4960
-26.5337
-26.3937
-26.3856
-26.3728
-26.3964
-26.4166
-26.4327
-26.4038
-26.3674
-26.2638
-26.1534
-26.0658
-26.0510
-26.0483
-26.0389
-25.9810
-26.0443
-25.9851
-25.9770
-25.9198
-25.8700
-25.8531
-25.8686
-25.8625
-25.9036
-25.9958
-26.0881
-26.0773
-26.1022
-26.0894
-26.1237
-26.1534
-26.1951
-26.2112
-26.2590
-26.3176
-26.3519
-26.3089
-26.3755
-26.4469
-26.5849
-26.6205
-26.6973
-26.7612
-26.8380
-26.8508
-26.8487
-26.9840
-27.0467
-27.1140
-27.1712
-27.2224
-27.2526
-27.2513
and this is the output of the pwelch() from DSP:
pxx_sx = pwelch(I_sx(570:970))
pxx_sx = 7043.99509673063
11644.5569003827
6455.19574077649
2247.33527612618
418.419085520639
25.8716525803097
0.241379153886240
0.219727631954535
0.0360675641941806
0.173566460147319
0.682167747712714
0.190180572625892
0.241387363165533
0.717710297747080
0.0866891794491317
0.371595110033528
0.701651401197791
0.0512352870193891
0.325757317891398
0.482422466203071
0.0115310246339952
0.334947330162198
0.347560433417062
0.00280910319719409
0.316868381840343
0.225217005806746
0.0186647932806373
0.376906354397266
0.238889516785153
0.00521936600798125
0.204174373656829
0.0786629204881135
0.0493182418041582
0.244324909727162
0.0630841760289611
0.0563107092331113
0.201165066521218
0.0319585032915665
0.0715995112815609
0.165911442308514
0.0122886724952156
0.0913135383951907
0.144961117009115
0.00469552565159905
0.0968991607335580
0.114738979042298
0.000505215232955028
0.0966866310150594
0.0823152225662298
0.00243009108059338
0.104166781848088
0.0634777517797514
0.00666177945439951
0.0995154150079024
0.0426500956153844
0.0145800246291918
0.0959121054451539
0.0274492499099761
0.0229864020361143
0.0883757712175194
0.0152532188182601
0.0327542962407699
0.0816271279390272
0.00777137516045686
0.0385332496733992
0.0679758425283955
0.00202707963479403
0.0471411396932288
0.0581699428371817
0.000207291419450440
0.0528221810897814
0.0475603504208714
0.000751877198188671
0.0551577345467582
0.0354173432458632
0.00372689980530504
0.0584637590792945
0.0267477617881123
0.00774031903310985
0.0565400237516173
0.0167298714937103
0.0146331798893914
0.0595470898355228
0.0138831156719556
0.0177088273429665
0.0477107528839032
0.00498651459720749
0.0284675925501540
0.0485273944246418
0.00195300450019559
0.0308046011266940
0.0401163066002232
0.000229547969600012
0.0364595843705069
0.0341250622584901
0.000364516846922977
0.0392477940022582
0.0263325987849415
0.00251536053243924
0.0429717038191161
0.0204531354326404
0.00547838894213586
0.0433747165479543
0.0140023083216393
0.00962969639786918
0.0424867822504836
0.00823527585224237
0.0152341250389282
0.0422302161901552
0.00471932515219331
0.0194736022464636
0.0377128344847568
0.00152511955516697
0.0256015990238373
0.0346070179924435
0.000274637418489702
0.0302501257091915
0.0299752943114966
0.000200085803745744
0.0327878546068529
0.0228968159826973
0.00205932069608192
0.0380893602848498
0.0188869996392939
0.00477588222203371
0.0402211356410538
0.0152309990724466
0.0105211012506845
0.0208092769955709
while this other one is the result from the pwelch() source code found from Octave:
pxx_sx_t = pwelch_r(I_sx(570:970))
3.70288869240553
2.20826281343221
0.0764382850559608
0.0254604504720041
0.0160990668784325
0.00447434006158207
0.00296399977959586
0.00162247506448442
0.00157682669543061
0.000860528976692023
0.00328820318575463
0.00378052742157819
0.00100836667971670
0.000549872960056774
0.000724331781856895
0.00165392374757721
0.00389279055274153
  1 comentario
marcusbarnet
marcusbarnet el 22 de Mayo de 2018
I tried to find out a solution, but I wasn't able to find anything so far :( Hope someone can help!

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Productos


Versión

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by