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 次查看(过去 30 天)
显示 更早的评论
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')
0 个评论
回答(1 个)
Prateekshya
2024-9-6
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!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!