I am trying to point values on the line on my plot. I am getting error using the semilogx. Please help
조회 수: 6 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Image Analyst
2017년 12월 5일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!