MATLAB: How to plot a horizontal line horizontal line s=0.5:0.001:1;f=yline(0.25);plot(s,f) How do I get this to produce a horizontal line at y=0.25 for the interval 0.5 <= s <= 1? Every time I run the script I get a blank graph. Thanks Best Answer s=0.5:0.001:1;f=repmat(0.25,1,length(s));plot(s,f) Related SolutionsMATLAB: How to separate signals with diffrent frequencies Add the following lines of code at the bottom of your code (after y=x+randn(size(x)).*sigma;):ffty = fft(y);ffty = abs(ffty(1:ceil(length(y)/2)));ffty(ffty<100)=0;[~,locs] = findpeaks(ffty);freqs = (locs-1)/t(end)signal_1 = sin(2*pi*t*freqs(1))+sin(2*pi*t*freqs(2))+sin(2*pi*t*freqs(3)); % 3-10signal_2 = sin(2*pi*t*freqs(6))+sin(2*pi*t*freqs(7)); % 50-100subplot(211), plot(t,signal_1)subplot(212), plot(t,signal_2) MATLAB: How to make a code that will count the number of times the sign changes succesively through an array pos = DAX>0; changes = xor(pos(1:end-1),pos(2:end)); num = sum(changes) Related QuestionShaded areas in scatter figureComparing two separate for loopsHow to add a dashed horizontal line at 0 using plot functionHow to replace values in a matrixWhy the square wave is just a line
Best Answer