how to mirror plots?

i hv theta value as 60 and 61 each theta value has phi of 120 240 with corresponding total values.
i hv to mirror data that is phi values data from 120 to 180 should be mirrored to 180 to 240 and then its plot is plotted. aim is to get plots symmetry xaxis is phi y axis is total with respect to theta percentile plots.i hv tried with excel sheet but my data is in .tab file how to import that format file and plot from it
a=xlsread('1GHzHH.xlsx');
theta=a(:,1);
phi=a(:,2);
total=a(:,3);
figure
plot(phi,total)
% f=[1];
% pol=['HH''VV'];
%
% for i=1:size(pol)
% m=strcat(pol,'GHz')
% j=strcat(f,m) %i m trying to read file which i hv imported file name is 1GHzHH.tab
% theta=data(:,1);
% phi=data(:,2);
% total=data(:,3);
% for j=1:nume1(theta)
% for k=1:nume1(phi)
%
% end
% end
% end

Answers (1)

I'm not aware of a function for this, but it can be achieved with logical indexing and some math.
data1GHH=readtable('1GHzHH.xlsx')
data1GHH = 242x3 table
theta phi total _____ ___ _____ 60 120 -4 60 121 -3 60 122 -2 60 123 -1 60 124 0 60 125 1 60 126 2 60 127 3 60 128 4 60 129 5 60 130 6 60 131 7 60 132 8 60 133 9 60 134 10 60 135 11
ind = data1GHH.phi<=180;
data1GHH.phi(ind) = abs(data1GHH.phi(ind)-180)+180;
plot(data1GHH,"phi","total")

5 Comments

??
ramya
ramya on 8 Aug 2024
i hv to get symmetry data and plot from given file
@ramya, Please confirm if is the line of reflection.
data1GHH= readtable('1GHzHH.xlsx');
phi = data1GHH.phi;
total = data1GHH.total;
subplot(211)
plot(phi(1:61), total(1:61)), xlim([120, 240]), grid on
xline(180, '--', 'color', 'red')
title('When \theta is 60')
xlabel('\phi'), ylabel('total')
subplot(212)
plot(phi(122:183), total(122:183)), xlim([120, 240]), grid on
xline(180, '--', 'color', 'red')
title('When \theta is 61')
xlabel('\phi'), ylabel('total')
ramya
ramya on 9 Aug 2024
I hv to plot on a single plot x-axis will be phi and y axis total values..and all this I hv to plot with respect to theta.. Symmetry in this I meant as I m taking a very small example to explain A=1 2 3 4 5 6; B=0.2 0.5 0.6 0.7 0.8 After mirroring the data from middle b will be B= 0.2 0.5 0.6 0.5. 0.2 And then plot the results
So similiar I hv to do for phi and total values
So the raw data looks like this
A=[1 2 3 4 5];
B=[0.2 0.5 0.6 0.7 0.8];
plot(B,A)
but should look like this
B= [0.2 0.5 0.6 0.5 0.2];
plot(B,A)
If I adapt the code I shared above for this example, it would look like this.
total=[1 2 3 4 5];
phi=[0.2 0.5 0.6 0.7 1]; % modifying your values so they are in fact symmetric
ind = phi>0.6;
phi(ind) = 0.6 - (phi(ind)-0.6)
phi = 1x5
0.2000 0.5000 0.6000 0.5000 0.2000
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
plot(phi,total)

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products

Release

R2021b

Tags

Asked:

on 7 Aug 2024

Commented:

on 9 Aug 2024

Community Treasure Hunt

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

Start Hunting!