Add various horizontal lines to a plot Matlab 2016a
Show older comments
clear all;
clc;
close all
x=[33.5 44 55 69 106 143 123 49 -25];
y=[61.8 53 45 73 77 81 156 68 -18];
z=[-7.5 -5 -2.5 -2.5 0 2.5 2.5 5 7.5];
zz=z(1:3:end)
for i=1:3
zz_n(i)=zz(i)
end
for i=1:3
hold on
plot(x,z)
plot(x,zz_n(i)*ones(size(x)),':')
plot(y,z)
hold off
end

Hi all, I am using Matlab 2016a and trying to add various horizontal lines .. I aready added but I would like the lines to reach y-axis... any help.
Accepted Answer
More Answers (1)
Sindar
on 5 May 2020
0 votes
See here for a few solutions:
Categories
Find more on Programming 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!