フィルターのクリア

draw a line to where the area approach?

1 回表示 (過去 30 日間)
Khang Nguyen
Khang Nguyen 2020 年 11 月 21 日
コメント済み: Khang Nguyen 2020 年 11 月 22 日
I want to draw a line to where the area is approaching. How should i do it?
% excersice 1:
clear all
a = 1
area = 0
figure;
hold on
for i = 1:20
a = a + a
area = area + (a *(1/8).^i)
scatter(i,area)
end
ylabel("value of series")
xlabel("n")

採用された回答

Image Analyst
Image Analyst 2020 年 11 月 22 日
You can use yline() if you have a fairly recent version of MATLAB:
% Exercise 1:
clear all
fontSize = 18;
a = 1
area = 0
figure;
hold on
for k = 1:20
a = a + a
area = area + (a *(1/8) .^ k)
plot(k, area, '.', 'MarkerSize', 40)
end
caption = sprintf('Final value at %.4f', area);
title(caption, 'FontSize', fontSize)
ylabel("value of series", 'FontSize', fontSize)
xlabel("n", 'FontSize', fontSize)
grid on;
yline(area, 'LineWidth', 2, 'Color', 'r');
  1 件のコメント
Khang Nguyen
Khang Nguyen 2020 年 11 月 22 日
what does yline do?

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

その他の回答 (1 件)

KSSV
KSSV 2020 年 11 月 22 日
a = 1 ;
i = 1:20 ;
area = zeros(size(i)) ;
for i = 1:20
a = a + a ;
area(i) = (a *(1/8).^i) ;
end
i = 1:20 ;
plot(i,cumsum(area))
ylabel("value of series")
xlabel("n")

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by