making a exponential from a for loop

13 ビュー (過去 30 日間)
Sebastian Sunny
Sebastian Sunny 2021 年 12 月 9 日
コメント済み: Rik 2021 年 12 月 10 日
Hi im trying to make 2 expontentials go from 1 - 10 as the exponential and 1- 8, might make better sense with the code;
for n = 1:10
k = 6*10^n;
for i = 1:8
Cd = 1.5*10^i;
end
end
  3 件のコメント
Image Analyst
Image Analyst 2021 年 12 月 9 日
編集済み: Image Analyst 2021 年 12 月 9 日
Um, do you have a question? Like how to plot Cd vs. i or how to index Cd so it's not being overwritten every iteration?
If so, ask it after you re-read the posting guidelines:
for n = 1:10
k(n) = 6*10^n;
end
subplot(2, 1, 1);
plot(k, '.-', 'LineWidth', 2, 'MarkerSize', 30);
grid on;
xlabel('n', 'fontSize', fontSize)
ylabel('k', 'fontSize', fontSize)
for i = 1:8
Cd(i) = 1.5*10^i;
end
subplot(2, 1, 2)
plot(Cd, '.-', 'LineWidth', 2, 'MarkerSize', 30);
grid on;
xlabel('i', 'fontSize', fontSize)
ylabel('Cd', 'fontSize', fontSize)

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

採用された回答

David Hill
David Hill 2021 年 12 月 9 日
k=6*10.^(1:10);
Cd=1.5*10.^(1:8);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by