Sample関数について, 数列をランダムに生成する方法
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
状態遷移関数から「天気」の数列をランダムに生成したいと考えているのですが、 以下のコードですとsample関数がうまく機能していないようなのでが、 何が問題かご存知の方教えて頂けると幸いです。
以下コード;
X_today = [ 0 1 0 ]'; % Cloudy
T = [ 8 2 0 ; 4 4 2 ; 2 6 2 ]' / 10;
X_tomorrow = sample( T * X_today );
if ( X_tomorrow(1) == 1 )
disp( 'sunny' );
elseif ( X_tomorrow(2) == 1 )
disp( 'cloudy' );
elseif ( X_tomorrow(3) == 1 )
disp( 'rainy' );
end
以下エラー;
関数または変数 'sample' が未定義です。
エラー: HW2_2 (line 5)
X_tomorrow = sample( T * X_today );
0 comentarios
Respuestas (1)
michio
el 8 de Feb. de 2017
Editada: michio
el 8 de Feb. de 2017
その手のエラーメッセージは一番良く出る基本的なエラーメッセージです。 ドキュメンテーションのこのページをご覧になって対処してみて下さい。
2 comentarios
michio
el 9 de Feb. de 2017
sampleという関数はMATLABの製品群の中には無いようですので、関数だとすればどなたかが独自に作られたものという可能性が高いですね。sample関数(もしくは変数)を使ったプログラムが Ishibashiさんの書かれたものでなければ、製作者に問い合わせるのが最も確実ですね。
数列をランダムに生成、というだけではなく X_tomorrow (出力)と T*X_today (入力)が明確に分かれば、他の関数を使って実装する道も見えてきます。
Ver también
Categorías
Más información sobre Text Analytics Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!