1990 年から 1999 年のデータに対応するインデックスのベクトルを作成し、変数 idx に保存したいです
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
めぐみ
le 15 Mai 2025
Réponse apportée : Kojiro Saito
le 15 Mai 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")
0 commentaires
Réponse acceptée
Kojiro Saito
le 15 Mai 2025
「解答を表示」をクリックしてもdecadeAnalysisSoln1.mlxというファイルが表示されませんでしょうか?
解答は
idx = 1:10;
です。
idx = 1990:1999と書きたくなるところですが、トリッキーな問題でして、ヒントを表示すると該当データが最初の1番目から10番目のインデックスになっていることが書かれています。
ヒント
1990 年から 1999 年までのデータは、各ベクトルの最初の 10 個の要素にあります。したがって、1 から 10 までのインデックスのベクトルを作成する必要があるということです。
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 時系列イベント dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!