How to make my graph longer?

5 views (last 30 days)
Heorhii
Heorhii on 5 Nov 2023
Answered: Image Analyst on 5 Nov 2023
a=(-10:2:10);
f=(5.*a-cos(2+a.^2)+sin(0.25.*a+2));
plot([a,f],'--');
hold on;
osx=zeros(size(a));
plot([a,f],'b--');
plot(osx)
hold off
So i have this code,for some reason I can't make my yellow( osx=zeros) be longer and it ends in the middle of the graph,while I need it to go further,if not endlessly

Accepted Answer

Image Analyst
Image Analyst on 5 Nov 2023
Instead of osx, just use yline
yline(0, 'Color', 'y', 'LineWidth', 3);

More Answers (0)

Categories

Find more on Specifying Target for Graphics Output in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!