How to plot only the maximum values of the listed variables in a scatter plot?

2 次查看(过去 30 天)
Hello,
I am new to coding and managed to get this far. I am trying to clean up this plot a little and help differentiate the y axis variables (Gain,PAE,PLRF_dBm) to only show the maximum values of Gain, PAE, and PLRF_dBm for each frequency. Basically, I would like to plot the maximum values from each variable listed above for each frequency. Any help would be greatly appeciated. I have read everything I could find but nothing works with my level of understanding. Thanks so much!!!
Pswpdata = readtable('csv_file.csv');
scatter(Pswpdata,'Frequency',{'Gain','PAE','PLRF_dBm'},'filled')
legend
title('GT,PAE & Pout (dB)')

采纳的回答

Dyuman Joshi
Dyuman Joshi 2023-10-23
移动:Dyuman Joshi 2023-10-23
Pswpdata = readtable('csv_file.csv')
Pswpdata = 49×26 table
Pavs_dB_set Pavs_set Frequency PinRF PavRF GinRF_real GinRF_imag GLRF_real GLRF_imag PLRF VectorGain_real VectorGain_imag PS1_V_base_2 PS1_I_base_2 PS2_V_col_2 PS2_I_col_2 Responsivity Resp_volt_on Resp_volt_off PinRF_dBm PavRF_dBm PLRF_dBm Gain GainT PAE Eff ___________ ________ _________ ________ ________ __________ __________ _________ _________ ________ _______________ _______________ ____________ ____________ ___________ ___________ ____________ ____________ _____________ _________ _________ ________ ______ ________ ________ ________ 9.5 0.008913 1.8e+11 1.3e-05 3.9e-05 -0.40094 -0.52629 0.14437 -0.19054 4.6e-05 -1.4258 -0.1085 1.484 0.005901 2.1 0.09601 -1000 -1000 -1000 -18.744 -14.092 -13.392 5.3515 0.69946 0.015417 0.021765 10.5 0.01122 1.8e+11 1.7e-05 5e-05 -0.40888 -0.51934 0.14434 -0.19058 5.9e-05 -1.4266 -0.033663 1.485 0.005901 2.1 0.096125 -1000 -1000 -1000 -17.645 -13.014 -12.318 5.3267 0.69602 0.019676 0.027842 11.5 0.014125 1.8e+11 2.5e-05 7.3e-05 -0.41009 -0.51849 0.14429 -0.19058 8.5e-05 -1.4252 0.010566 1.4852 0.005901 2.1 0.09614 -1000 -1000 -1000 -16.015 -11.385 -10.697 5.3174 0.68758 0.028546 0.04043 12.5 0.017783 1.8e+11 6.7e-05 0.000192 -0.41176 -0.51566 0.14432 -0.19055 0.000223 -1.4166 0.039907 1.4846 0.005901 2.1 0.09612 -1000 -1000 -1000 -11.767 -7.1558 -6.5111 5.2558 0.64464 0.074415 0.10602 13.5 0.022387 1.8e+11 0.000196 0.000568 -0.41292 -0.516 0.14431 -0.19056 0.000647 -1.4033 0.061581 1.4851 0.005901 2.1 0.09607 -1000 -1000 -1000 -7.0789 -2.4562 -1.8902 5.1887 0.56608 0.21433 0.3074 14.5 0.028184 1.8e+11 0.001856 0.005365 -0.41434 -0.51396 0.14437 -0.19047 0.005463 -1.3243 0.088082 1.4818 0.005901 2.101 0.095135 -1000 -1000 -1000 2.6853 7.296 7.3744 4.6891 0.078333 1.7291 2.6187 15.5 0.035481 1.8e+11 0.011099 0.032409 -0.40748 -0.52239 0.14443 -0.19034 0.023011 -1.1021 0.13808 1.4568 0.005901 2.1 0.08959 -1000 -1000 -1000 10.453 15.107 13.619 3.1665 -1.4872 6.0549 11.697 9.5 0.008913 1.85e+11 0.000122 0.000331 -0.53329 -0.37641 0.037686 -0.38289 0.000421 -1.4349 0.51454 1.4853 0.005901 2.1 0.09601 -1000 -1000 -1000 -9.13 -4.8044 -3.7526 5.3774 1.0518 0.14225 0.20032 10.5 0.01122 1.85e+11 0.00017 0.000459 -0.53465 -0.37408 0.037699 -0.3829 0.000582 -1.4255 0.52291 1.4849 0.005901 2.101 0.09599 -1000 -1000 -1000 -7.6942 -3.3787 -2.3532 5.3409 1.0255 0.1956 0.27641 11.5 0.014125 1.85e+11 0.000241 0.00065 -0.5361 -0.37299 0.037698 -0.38289 0.000816 -1.4157 0.52855 1.4844 0.005901 2.1 0.095845 -1000 -1000 -1000 -6.1888 -1.8715 -0.88348 5.3054 0.98798 0.27397 0.38848 12.5 0.017783 1.85e+11 0.000352 0.000951 -0.53665 -0.37249 0.037733 -0.38291 0.001178 -1.4034 0.5318 1.4852 0.005901 2.101 0.0958 -1000 -1000 -1000 -4.5357 -0.21837 0.71114 5.2468 0.92951 0.39326 0.56081 13.5 0.022387 1.85e+11 0.000501 0.001353 -0.53655 -0.37193 0.037733 -0.3829 0.001645 -1.3884 0.53124 1.4844 0.005901 2.1 0.09556 -1000 -1000 -1000 -2.9978 1.3137 2.1627 5.1605 0.84901 0.54621 0.78563 14.5 0.028184 1.85e+11 0.001762 0.004729 -0.53784 -0.36807 0.037658 -0.38285 0.005183 -1.3119 0.51455 1.4836 0.0059 2.1 0.094215 -1000 -1000 -1000 2.4603 6.7478 7.1455 4.6852 0.39773 1.6556 2.5085 15.5 0.035481 1.85e+11 0.006721 0.01807 -0.53879 -0.36812 0.037654 -0.38278 0.015149 -1.1251 0.50306 1.4724 0.005901 2.1 0.087825 -1000 -1000 -1000 8.2741 12.57 11.804 3.5298 -0.76575 4.3644 7.8444 9.5 0.008913 1.9e+11 0.001226 0.002191 -0.58416 -0.26438 -0.086695 -0.24705 0.004164 -1.1355 0.92611 1.4841 0.005901 2.101 0.094835 -1000 -1000 -1000 0.88553 3.4057 6.1956 5.3101 2.7899 1.4126 2.0021 10.5 0.01122 1.9e+11 0.001788 0.003189 -0.58409 -0.26327 -0.086711 -0.24704 0.005859 -1.1112 0.91579 1.4837 0.0059 2.1 0.094345 -1000 -1000 -1000 2.5246 5.0369 7.6783 5.1537 2.6413 1.9677 2.8321
%Compute the min and max values by the groups of Frequency Variable
T1 = groupsummary(Pswpdata, 'Frequency', 'max')
T1 = 7×27 table
Frequency GroupCount max_Pavs_dB_set max_Pavs_set max_PinRF max_PavRF max_GinRF_real max_GinRF_imag max_GLRF_real max_GLRF_imag max_PLRF max_VectorGain_real max_VectorGain_imag max_PS1_V_base_2 max_PS1_I_base_2 max_PS2_V_col_2 max_PS2_I_col_2 max_Responsivity max_Resp_volt_on max_Resp_volt_off max_PinRF_dBm max_PavRF_dBm max_PLRF_dBm max_Gain max_GainT max_PAE max_Eff _________ __________ _______________ ____________ _________ _________ ______________ ______________ _____________ _____________ ________ ___________________ ___________________ ________________ ________________ _______________ _______________ ________________ ________________ _________________ _____________ _____________ ____________ ________ _________ _______ _______ 1.8e+11 7 15.5 0.035481 0.011099 0.032409 -0.40094 -0.51396 0.14443 -0.19034 0.023011 -1.1021 0.13808 1.4852 0.005901 2.101 0.09614 -1000 -1000 -1000 10.453 15.107 13.619 5.3515 0.69946 6.0549 11.697 1.85e+11 7 15.5 0.035481 0.006721 0.01807 -0.53329 -0.36807 0.037733 -0.38278 0.015149 -1.1251 0.5318 1.4853 0.005901 2.101 0.09601 -1000 -1000 -1000 8.2741 12.57 11.804 5.3774 1.0518 4.3644 7.8444 1.9e+11 7 15.5 0.035481 0.017723 0.032338 -0.56655 -0.2616 -0.086695 -0.24701 0.029105 -0.72841 0.92611 1.4841 0.005901 2.101 0.094835 -1000 -1000 -1000 12.485 15.097 14.64 5.3101 2.7899 6.5312 16.701 1.95e+11 7 15.5 0.035481 0.006511 0.010521 -0.62389 -0.14678 -0.10821 -0.083342 0.015288 -0.63048 1.2383 1.4846 0.005901 2.1 0.0959 -1000 -1000 -1000 8.1365 10.22 11.844 5.6265 3.5571 4.4744 7.7937 2e+11 7 15.5 0.035481 0.016449 0.029244 -0.64307 -0.000384 0.044276 -0.037411 0.028298 -0.27086 1.3764 1.4846 0.005901 2.1 0.096005 -1000 -1000 -1000 12.161 14.66 14.518 5.6244 3.1645 6.5198 15.571 2.05e+11 7 15.5 0.035481 0.007507 0.012945 -0.59975 0.1692 0.10554 -0.26111 0.018151 0.047854 1.5885 1.4849 0.005901 2.101 0.09555 -1000 -1000 -1000 8.7548 11.121 12.589 5.9261 3.4295 5.7252 9.7636 2.1e+11 7 15.5 0.035481 0.016792 0.020756 -0.49666 0.28749 0.053181 -0.33378 0.029596 0.52755 1.5455 1.4851 0.005901 2.1 0.09551 -1000 -1000 -1000 12.251 13.172 14.712 5.5379 4.5783 7.6077 17.584
T2 = groupsummary(Pswpdata, 'Frequency', 'min')
T2 = 7×27 table
Frequency GroupCount min_Pavs_dB_set min_Pavs_set min_PinRF min_PavRF min_GinRF_real min_GinRF_imag min_GLRF_real min_GLRF_imag min_PLRF min_VectorGain_real min_VectorGain_imag min_PS1_V_base_2 min_PS1_I_base_2 min_PS2_V_col_2 min_PS2_I_col_2 min_Responsivity min_Resp_volt_on min_Resp_volt_off min_PinRF_dBm min_PavRF_dBm min_PLRF_dBm min_Gain min_GainT min_PAE min_Eff _________ __________ _______________ ____________ _________ _________ ______________ ______________ _____________ _____________ ________ ___________________ ___________________ ________________ ________________ _______________ _______________ ________________ ________________ _________________ _____________ _____________ ____________ ________ _________ ________ ________ 1.8e+11 7 9.5 0.008913 1.3e-05 3.9e-05 -0.41434 -0.52629 0.14429 -0.19058 4.6e-05 -1.4266 -0.1085 1.4568 0.005901 2.1 0.08959 -1000 -1000 -1000 -18.744 -14.092 -13.392 3.1665 -1.4872 0.015417 0.021765 1.85e+11 7 9.5 0.008913 0.000122 0.000331 -0.53879 -0.37641 0.037654 -0.38291 0.000421 -1.4349 0.50306 1.4724 0.0059 2.1 0.087825 -1000 -1000 -1000 -9.13 -4.8044 -3.7526 3.5298 -0.76575 0.14225 0.20032 1.9e+11 7 9.5 0.008913 0.001226 0.002191 -0.58416 -0.2962 -0.086888 -0.24708 0.004164 -1.1355 0.71551 1.4243 0.0059 2.099 0.078945 -1000 -1000 -1000 0.88553 3.4057 6.1956 2.1543 -0.45748 1.4126 2.0021 1.95e+11 7 9.5 0.008913 0.000205 0.00033 -0.62484 -0.15382 -0.10848 -0.083585 0.000748 -0.80872 1.0033 1.4661 0.0059 2.1 0.08929 -1000 -1000 -1000 -6.8895 -4.8202 -1.263 3.707 1.6231 0.25838 0.35577 2e+11 7 9.5 0.008913 0.000148 0.000261 -0.64764 -0.032687 0.044143 -0.037638 0.000542 -0.48201 0.96494 1.4256 0.005901 2.1 0.082535 -1000 -1000 -1000 -8.286 -5.8261 -2.6616 2.3561 -0.14288 0.18703 0.25757 2.05e+11 7 9.5 0.008913 0.000462 0.000821 -0.61465 0.1636 0.10536 -0.26121 0.001809 -0.001864 1.2684 1.4714 0.005901 2.1 0.08439 -1000 -1000 -1000 -3.3522 -0.85556 2.5739 3.8341 1.468 0.64305 0.86374 2.1e+11 7 9.5 0.008913 0.000659 0.000822 -0.5073 0.26213 0.052897 -0.3339 0.002358 0.46912 1.067 1.4512 0.0059 2.1 0.07607 -1000 -1000 -1000 -1.8133 -0.85368 3.7246 2.4614 1.5409 0.81157 1.1262
%Find the indices of the variables to be added
names = Pswpdata.Properties.VariableNames;
str = {'Gain','PAE','PLRF_dBm'};
%Adding 1 to the indices as the output by groupsummary() has an extra
%column for groupcounts
idx = find(ismember(names, str)) + 1;
%Plot the corresponding values
scatter(T1,'Frequency',idx,'filled')
hold on
scatter(T2,'Frequency',idx,'filled')
legend('Location', 'Best')
title('GT,PAE & Pout (dB)')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Scatter Plots 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by