I am trying to point values on the line on my plot. I am getting error using the semilogx. Please help
6 views (last 30 days)
Show older comments
clc;
clear all;
M= [1 10 100 1000 10000 100000 1000000]
delta= [ 3 4 5 6]
cp= delta/3
%For Short Term p
p(1)= 2.* normcdf(-3*cp(1))
for i= 2:4
p(i) = 0.5.*(1+sign(-3*cp(i)).*(erf(abs(-3.*cp(i))./sqrt(2))));
end
p_short(:,:)=p
%Using bionomial distribution for M=1 and M=10
for i=1:2
Y(i,:)=(1-p_short).^M(i)
end
%Using Poission Distribution for M= 100 and higher
for i=3:7
Y(i,:)= exp(-p_short.*M(i));
end
%Plot for Short Term p
Z(:,:)= Y*100
figure;
semilogx(M,Z(:,1),'LineWidth',2,'-o')
The line semilogx(M,Z(:,1),'LineWidth',2,'-o') does not work.
Here is the error: Error using semilogx String argument is an unknown option.
Error in reliability4 (line 23) semilogx(M,Z(:,1),'LineWidth',2,'-o')
0 Comments
Answers (1)
Image Analyst
on 5 Dec 2017
You had the 'o-' in the wrong place. Try this (it works):
% Plot for Short Term p
Z = Y * 100
column1 = Z(:, 1)';
semilogx(M, column1, 'o-', 'LineWidth', 2)
grid on;
0 Comments
See Also
Categories
Find more on Line Plots 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!