seimlogx not working in an iteration

5 ビュー (過去 30 日間)
James Stine
James Stine 2018 年 4 月 24 日
コメント済み: James Stine 2018 年 4 月 24 日
I am working on a MATLAB script that iterates over several values and the code is attached. For some reason it doesn't see semiology. If I plot each value of r individually, but within the script it just gives me a linear scale. A bug?
%
% Amdahl's Law
% ECEN 4243
%
clear
clc ; clf
r = [0.90 0.96 0.98 0.99];
n=1:10000;
hold on
for i = 1:length(r)
S(i,:) = 1./((r(i)./n)+(1-r(i)));
semilogx(S(i,:))
end

採用された回答

Kelly Kearney
Kelly Kearney 2018 年 4 月 24 日
The hold on command is the culprit... you're issuing it before you plot, so the linear axis is being held throughout. If you move the hold command after the first call to semilogx, it should work as intended.
  1 件のコメント
James Stine
James Stine 2018 年 4 月 24 日
Great answer! Thank you!!!!!!!!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by