how to plot 50 percentile?

3 views (last 30 days)
ramya
ramya on 6 Mar 2024
Answered: Voss on 6 Mar 2024
filename = 'Book11.csv';
M = readtable(filename);
disp(M)
freq theta phi rcs _____ _____ ___ _______ 1e+05 90 0 -5.63 1e+05 90 20 -5.0668 1e+05 90 40 -4.5036 1e+05 90 60 -3.9404 1e+05 90 80 -3.3772 1e+05 90 100 -2.814 1e+05 90 120 -2.2508 1e+05 90 140 -1.6876 1e+05 90 160 -1.1244 1e+05 90 180 -0.5612 1e+05 90 200 0.002 1e+05 90 220 0.5652 1e+05 90 240 1.1284 1e+05 90 260 1.6916 1e+05 90 280 2.2548 1e+05 90 300 2.818 1e+05 90 320 3.3812 1e+05 90 340 3.9444 1e+05 90 360 4.5076 2e+05 90 0 5.0708 2e+05 90 20 5.634 2e+05 90 40 6.1972 2e+05 90 60 6.7604 2e+05 90 80 7.3236 2e+05 90 100 7.8868 2e+05 90 120 8.45 2e+05 90 140 9.0132 2e+05 90 160 9.5764 2e+05 90 180 10.14 2e+05 90 200 10.703 2e+05 90 220 11.266 2e+05 90 240 11.829 2e+05 90 260 12.392 2e+05 90 280 12.956 2e+05 90 300 13.519 2e+05 90 320 14.082 2e+05 90 340 14.645 2e+05 90 360 15.208 3e+05 90 0 15.772 3e+05 90 20 16.335 3e+05 90 40 16.898 3e+05 90 60 17.461 3e+05 90 80 18.024 3e+05 90 100 18.588 3e+05 90 120 19.151 3e+05 90 140 19.714 3e+05 90 160 20.277 3e+05 90 180 20.84 3e+05 90 200 21.404 3e+05 90 220 21.967 3e+05 90 240 22.53 3e+05 90 260 23.093 3e+05 90 280 23.656 3e+05 90 300 24.22 3e+05 90 320 24.783 3e+05 90 340 25.346 3e+05 90 360 25.909 4e+05 90 0 26.472 4e+05 90 20 27.036 4e+05 90 40 27.599 4e+05 90 60 28.162 4e+05 90 80 28.725 4e+05 90 100 29.288 4e+05 90 120 29.852 4e+05 90 140 30.415 4e+05 90 160 30.978 4e+05 90 180 31.541 4e+05 90 200 32.104 4e+05 90 220 32.668 4e+05 90 240 33.231 4e+05 90 260 33.794 4e+05 90 280 34.357 4e+05 90 300 34.92 4e+05 90 320 35.484 4e+05 90 340 36.047 4e+05 90 360 36.61
h=M{:} %i have to select all data for phi from 120 240 only and plot 50 percentile
Error using {}
Subscripting into a table using one subscript (as in t(i)) is not supported. Specify a row subscript and a variable subscript, as in t(rows,vars). To select variables, use t(:,i) or for one variable t.(i). To select rows, use t(i,:).
a=M{:,3}
b=90;
f=unique(M(:,1)); %freq
rcs=r{:,4};
r = rcs(find(a >=120 & a <= 240))
size(r)
t=prctile(r,50)
plot(a,t,'k'); hold on; grid on
plot(a,t,'r')
legend('original','average')

Answers (1)

Voss
Voss on 6 Mar 2024
filename = 'Book11.csv';
M = readtable(filename);
disp(M)
freq theta phi rcs _____ _____ ___ _______ 1e+05 90 0 -5.63 1e+05 90 20 -5.0668 1e+05 90 40 -4.5036 1e+05 90 60 -3.9404 1e+05 90 80 -3.3772 1e+05 90 100 -2.814 1e+05 90 120 -2.2508 1e+05 90 140 -1.6876 1e+05 90 160 -1.1244 1e+05 90 180 -0.5612 1e+05 90 200 0.002 1e+05 90 220 0.5652 1e+05 90 240 1.1284 1e+05 90 260 1.6916 1e+05 90 280 2.2548 1e+05 90 300 2.818 1e+05 90 320 3.3812 1e+05 90 340 3.9444 1e+05 90 360 4.5076 2e+05 90 0 5.0708 2e+05 90 20 5.634 2e+05 90 40 6.1972 2e+05 90 60 6.7604 2e+05 90 80 7.3236 2e+05 90 100 7.8868 2e+05 90 120 8.45 2e+05 90 140 9.0132 2e+05 90 160 9.5764 2e+05 90 180 10.14 2e+05 90 200 10.703 2e+05 90 220 11.266 2e+05 90 240 11.829 2e+05 90 260 12.392 2e+05 90 280 12.956 2e+05 90 300 13.519 2e+05 90 320 14.082 2e+05 90 340 14.645 2e+05 90 360 15.208 3e+05 90 0 15.772 3e+05 90 20 16.335 3e+05 90 40 16.898 3e+05 90 60 17.461 3e+05 90 80 18.024 3e+05 90 100 18.588 3e+05 90 120 19.151 3e+05 90 140 19.714 3e+05 90 160 20.277 3e+05 90 180 20.84 3e+05 90 200 21.404 3e+05 90 220 21.967 3e+05 90 240 22.53 3e+05 90 260 23.093 3e+05 90 280 23.656 3e+05 90 300 24.22 3e+05 90 320 24.783 3e+05 90 340 25.346 3e+05 90 360 25.909 4e+05 90 0 26.472 4e+05 90 20 27.036 4e+05 90 40 27.599 4e+05 90 60 28.162 4e+05 90 80 28.725 4e+05 90 100 29.288 4e+05 90 120 29.852 4e+05 90 140 30.415 4e+05 90 160 30.978 4e+05 90 180 31.541 4e+05 90 200 32.104 4e+05 90 220 32.668 4e+05 90 240 33.231 4e+05 90 260 33.794 4e+05 90 280 34.357 4e+05 90 300 34.92 4e+05 90 320 35.484 4e+05 90 340 36.047 4e+05 90 360 36.61
a=M{:,3};
rcs=M{:,4};
idx = a >=120 & a <= 240;
p = a(idx);
r = rcs(idx);
t=prctile(r,50)
t = 15.4900
plot(a,rcs,'.k'); hold on; grid on
plot(p,r,'gs')
plot([120 240],[t t],'r')
legend('all','120<=phi<=240','median')

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!