how to reverse a polt in matlab

To reverse a plot in MATLAB, you can simply use the 'set' function to reverse the x or y-axis.

Here's an example:

main.m
x = 1:10;
y = x.^2; % some arbitrary data

plot(x,y) % plot the data
set(gca,'XDir','reverse') % reverse the x-axis
116 chars
6 lines

In this example, the plot function plots y against x. The set function is used with the gca (get current axis) function to set the direction of the x-axis to be reversed using 'XDir'. The same concept can be applied to reverse the y-axis, by simply changing 'XDir' to 'YDir'.

main.m
x = 1:10;
y = x.^2; % some arbitrary data

plot(x,y) % plot the data
set(gca,'YDir','reverse') % reverse the y-axis
116 chars
6 lines

I hope this helps!

gistlibby LogSnag