How to plot a part of an array?
149 次查看(过去 30 天)
显示 更早的评论
lets say i have
x = 1:20
and i have this eqution;
y = 2x+3
how to plot (x,y) where x only goes up to 10 while the whole 20 numbers are still avalible on the plot, just as empty space?
In another words i want to adjust the size of my x axis and y axis without it being automatically adjusted by Matlab.
0 个评论
采纳的回答
Manikanta Aditya
2024-4-5
Hi, check this:
% Create the x vector
x = 1:20;
% Calculate y based on the equation
y = 2 * x + 3;
% Create a figure and plot the data
figure;
plot(x, y);
% Set the x-axis limits to display the full range of 1 to 20
xlim([1 20]);
% Add labels and a title
xlabel('x');
ylabel('y');
title('Plot of y = 2x + 3');
Thanks!
7 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!