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 vue (au cours des 30 derniers jours)
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')

Réponses (1)

Prateekshya
Prateekshya le 6 Sep 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!

Catégories

En savoir plus sur Data Exploration dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by