フィルターのクリア

For loop code/ help

1 回表示 (過去 30 日間)
Amine Ben Ayara
Amine Ben Ayara 2015 年 8 月 19 日
回答済み: Walter Roberson 2015 年 8 月 19 日
Hello Matlab wizards, So I just finished my 10th attempt at writing a code using for loops. The output was correct. MY issue is that I'm not being successful at adding one more loop that will allow matlab to rerun the same simulation 10 times, so I can get 90 matrices (3*3 each) and 10 matrices (9*3) in the end results. here is my code:
function [ MN ] = ProbabiltyMatrices( X,Lam,Y)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
for i=1:9
for l=1:3
for j=1:3
Den(i,l,n)=exp (Y(i+1,l)* dot(X(i,:),Lam(1,:))) + exp(Y(i+1,l)* dot(X(i,:),Lam(2,:))) +exp(Y(i+1,l)* dot(X(i,:),Lam(3,:)));
MN(l,j,i,n) = exp(Y(i+1,l)* dot(X(i,:),Lam(j,:)))/Den(i,l,n);
end
end
end
Ml =transpose(transpose(MN(:,:,1))* transpose(Y(2,:)));
for i=2:9
Ml(i,:)=transpose(transpose(MN(:,:,i))* transpose(Ml(i-1,:)));
end
M=Ml;
Would someone please help! Thanks

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 8 月 19 日

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by