How can I mirror a plot from a specific x axis.
7 views (last 30 days)
Show older comments
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]
0 Comments
Accepted Answer
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]
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]
plot(x,y)
hold on
% val = 6.25e-3
val = max(x)
plot(2*val-x,y)
More Answers (1)
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)
0 Comments
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!