1990 年から 1999 年のデータに対応する​インデックスのベクト​ルを作成し、変数 idx に保存したいです

6 views (last 30 days)
めぐみ
めぐみ on 15 May 2025
Answered: Kojiro Saito on 15 May 2025
matlab 部分行列の抽出と修正ベクトルの複数の要素を抽出する(2/3) 10 年分のデータの抽出
の問題の解答が無く進められません。回答を教えていただけますか?
load eurGasPrices
Fr2 = France(2);
France(1) = Fr2;
plot(Year,France)
hold on
plot(Year,Germany)
hold off
title("Gasoline Prices in USD/gal over time")
legend("France","Germany")

Accepted Answer

Kojiro Saito
Kojiro Saito on 15 May 2025
オンラインコースの「行列の作成と操作」の問題ですね。
「解答を表示」をクリックしてもdecadeAnalysisSoln1.mlxというファイルが表示されませんでしょうか?
解答は
idx = 1:10;
です。
idx = 1990:1999と書きたくなるところですが、トリッキーな問題でして、ヒントを表示すると該当データが最初の1番目から10番目のインデックスになっていることが書かれています。
ヒント
1990 年から 1999 年までのデータは、各ベクトルの最初の 10 個の要素にあります。したがって、1 から 10 までのインデックスのベクトルを作成する必要があるということです。

More Answers (0)

Categories

Find more on 時系列イベント in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!