Correct use of Semilogx
5 views (last 30 days)
Show older comments
Akash Agarwal
on 6 Jul 2015
Commented: Azzi Abdelmalek
on 6 Jul 2015
I have the following script:
clear all;close all; clc
x = 0:.01:50;
r=[.01, .05, 1];
for ri = 1:3
[y] = HW1_4_func(x,r(ri));
xd = y(1:50);
deltax = .01;
dy = diff(y)/deltax;
subplot (3,1,ri)
hold on
semilogx (y, 'b');
semilogx (dy, 'r');
legend ('y', 'dy');
xlabel('Time')
ylabel('Height')
caption = sprintf('R= .01 (plot 1), .5 (plot 2), and 1 (plot 3)');
title(caption, 'FontSize', 10);
end
and the following function:
function [y, dy] = HW1_4_func(x,r)
y = (1+r).*exp(x) ./ (1+r.*exp((1+r)*x));
How do I change it so that when it plots, the X-axis changes to a log scale. I tried the semilogx (y, 'b') and semilogx (dy, 'r') and nothing happens. What am I doing wrong when plotting?
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Two y-axis 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!