Clear Filters
Clear Filters

How can I mirror a plot from a specific x axis.

7 views (last 30 days)
I have two set a data x from 0 to 6.25 and y from 0 to 3.5e6. I want to mirror the plot (x,y) with respect to a specific x-axis (x=6.25). and plot(x,y) this time for x from 0 to 12.
My set of data
x=[
0.00630656
0.00615694
0.00602694
0.00593928
0.0058094
0.00566972
0.00552689
0.00523467
0.00493265
0.0045527
0.00412081
0.00373113
0.0035459
0.00330861
0.00302565
0.00277845
0.00250505
0.0022674
0.00202952
0.00180137
0.00161531
0.00144231
0.00131163
0.00114815
8.08E-04
5.13E-04
3.29E-04
1.84E-04
2.68E-08
0]
y=[
8.88E+05
9.26E+05
9.91E+05
1.06E+06
1.15E+06
1.24E+06
1.35E+06
1.57E+06
1.78E+06
2.04E+06
2.34E+06
2.62E+06
2.71E+06
2.81E+06
2.89E+06
2.96E+06
2.98E+06
2.99E+06
2.93E+06
2.87E+06
2.74E+06
2.62E+06
2.50E+06
2.31E+06
1.84E+06
1.35E+06
8.96E+05
5.36E+05
7206.62
0]

Accepted Answer

Voss
Voss on 14 Feb 2024
x=[
0.00630656
0.00615694
0.00602694
0.00593928
0.0058094
0.00566972
0.00552689
0.00523467
0.00493265
0.0045527
0.00412081
0.00373113
0.0035459
0.00330861
0.00302565
0.00277845
0.00250505
0.0022674
0.00202952
0.00180137
0.00161531
0.00144231
0.00131163
0.00114815
8.08E-04
5.13E-04
3.29E-04
1.84E-04
2.68E-08
0]
x = 30×1
0.0063 0.0062 0.0060 0.0059 0.0058 0.0057 0.0055 0.0052 0.0049 0.0046
y=[
8.88E+05
9.26E+05
9.91E+05
1.06E+06
1.15E+06
1.24E+06
1.35E+06
1.57E+06
1.78E+06
2.04E+06
2.34E+06
2.62E+06
2.71E+06
2.81E+06
2.89E+06
2.96E+06
2.98E+06
2.99E+06
2.93E+06
2.87E+06
2.74E+06
2.62E+06
2.50E+06
2.31E+06
1.84E+06
1.35E+06
8.96E+05
5.36E+05
7206.62
0]
y = 30×1
888000 926000 991000 1060000 1150000 1240000 1350000 1570000 1780000 2040000
plot(x,y)
hold on
% val = 6.25e-3
val = max(x)
val = 0.0063
plot(2*val-x,y)

More Answers (1)

Mathieu NOE
Mathieu NOE on 14 Feb 2024
maybe this ?
x=[
0.00630656
0.00615694
0.00602694
0.00593928
0.0058094
0.00566972
0.00552689
0.00523467
0.00493265
0.0045527
0.00412081
0.00373113
0.0035459
0.00330861
0.00302565
0.00277845
0.00250505
0.0022674
0.00202952
0.00180137
0.00161531
0.00144231
0.00131163
0.00114815
8.08E-04
5.13E-04
3.29E-04
1.84E-04
2.68E-08
0];
y=[
8.88E+05
9.26E+05
9.91E+05
1.06E+06
1.15E+06
1.24E+06
1.35E+06
1.57E+06
1.78E+06
2.04E+06
2.34E+06
2.62E+06
2.71E+06
2.81E+06
2.89E+06
2.96E+06
2.98E+06
2.99E+06
2.93E+06
2.87E+06
2.74E+06
2.62E+06
2.50E+06
2.31E+06
1.84E+06
1.35E+06
8.96E+05
5.36E+05
7206.62
0];
% put back the data in ascending order (simpler)
[x,ind] = sort(x);
y = y(ind);
% create mirrored data
xx = -x(2:end)+2*max(x);
yy = y(2:end);
plot(x,y)
hold on
plot(xx,yy)

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!