hi..i am getting an error while using the "axis" function....the value that i gave was [0 255 0 1] ....0 to 255 are grey scale values of image on the x axis and 0 to 1 the cdf on the y axis....

1 visualización (últimos 30 días)
x = linspace(0,1,255) plot(x,cdf_data) axis(0 , 255 , 0 , 1) set (gca, 'xtick', 0:1:255) set (gca, 'ytick', 0:0.2:1) xlabel('input intensity values') ylabel('output intensity values')

Respuestas (1)

Prateekshya
Prateekshya el 6 de Sept. de 2024
Hello Vishwas,
It looks like there might be a small syntax error in your use of the axis function. In MATLAB, the axis function should receive a single vector as its argument, not separate values. You should pass the axis limits as a vector like [xmin xmax ymin ymax]. Here is a sample code for the same:
x = linspace(0, 1, 255); % Assuming cdf_data has the same length
plot(x, cdf_data);
% Set axis limits
axis([0 1 0 1]); % Adjusted to match the range of 'x'
% Set ticks on the axes
set(gca, 'xtick', 0:0.1:1); % Adjusted to match the range of 'x'
set(gca, 'ytick', 0:0.2:1);
% Label the axes
xlabel('Input intensity values');
ylabel('Output intensity values');
Make sure cdf_data is defined and has the same length as x, otherwise, you might encounter additional errors related to mismatched dimensions. Adjust the axis and tick settings based on the actual range of your data.
I hope this helps!

Categorías

Más información sobre Data Exploration en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by