Ask an expert. Trust the answer.

Your academic and career questions answered by verified experts

semilog plots with hold on

Date: 2023-03-17 14:32:30

If I try to plot multiple plots with a logarithmic axis, the log scale is disabled. If I remove the hold on the log scale is enabled, but I can only plot a single plot. 

 

figure(1); clf
x = linspace(0,1,100);
y = exp(-x);

hold on;
semilogy(x, y);
semilogy(x, 2*y);
hold off;

Why?, How can I create multiple log scale plots? 

Answer:

Your code works already in octave (and I don't have matlab at this computer), but I think the problem is that you do hold on before the first plot, hence preventing the initial axis to be created. try this: 

 

figure(1); clf
x = linspace(0,1,100);
y = exp(-x);

semilogy(x, y);
hold on;
semilogy(x, 2*y);
hold off;

 


Why Matlabhelpers ?

Our Matlab assignment helpers for online MATLAB assignment help service take utmost care of your assignments by keeping the codes simple yet of high-quality. We offer the most reliable MATLAB solutions to students pursuing their Computer Science course from the Monash University, the University of Sydney, the University of New South Wales, the University of Melbourne; to name a few. Approach us today for best Matlab solutions online!

whatsApp order on matlabhelpers.com

telegram order on matlabsolutions.com