Hi MATLAB Team,
I would to ask an help please,
I am executing a function, it's works normally, but, not create the variable (such as : S, m, d2) on the workspace,
Could you help me, please?
Thank you
Guilherme Lopes
X = table2array(matrizmediad54);
function normalidade(X)
[n,p]=size(X);
m=mean(X);
S =cov(X);
% for i = 1:n
% d2(i)=(X(i,:)-m(i))*inv(S)*transpose((X(i,:)-m(i)));
% end
% em ordem crescente
d2 = X*inv(S)*transpose(X);
d2 = sort(d2)
for j=1:n
qui2(j)=chi2inv((j-0.5)/n,p)
end
plot(d2,qui2,'*k'), xlabel('d2'), ylabel('qui2'),grid
end

 採用された回答

madhan ravi
madhan ravi 2019 年 2 月 7 日

0 投票

function [S,m,d2]=.... callthe function with three output arguments so they appear in workspace

3 件のコメント

Guilherme Lopes de Campos
Guilherme Lopes de Campos 2019 年 2 月 7 日
Like that Madhan?
X = table2array(matrizmediad54);
[S,m,d2]=normalidade(X);
function [S,m,d2] = normalidade(X)
[n,p]=size(X);
m=mean(X);
S =cov(X);
% for i = 1:n
% d2(i)=(X(i,:)-m(i))*inv(S)*transpose((X(i,:)-m(i)));
% end
% em ordem crescente
d2 = X*inv(S)*transpose(X);
d2 = sort(d2);
for j=1:n
qui2(j)=chi2inv((j-0.5)/n,p);
end
plot(d2,qui2,'*k'), xlabel('d2'), ylabel('qui2'),grid
end
madhan ravi
madhan ravi 2019 年 2 月 7 日
Exactly.
Guilherme Lopes de Campos
Guilherme Lopes de Campos 2019 年 2 月 7 日
Thank you Madhan,
I am very grateful,
Guilherme Lopes de Campos

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

その他の回答 (0 件)

カテゴリ

製品

リリース

R2018b

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by