Making a statistics function output a matrix
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a function that calculates the skewness and kurtosis ratios simultaneously with two outputs, [skewness, kurtosis]
Essentially, I want to compare multiple outputs in a big matrix, with each line or column being a different skewness/kurtosis ratio
As completely embarassing as this is, this is what I am trying to do:
function [m] = matrix(a,b, c)
%ratios calculates skewness and kurtosis ratios
[sk ku] = ratios(y.a);
[sk2 ku2] = ratios(y.b);
[sk3 ku3] = ratios(y.c);
% m is the theoretical output matrix that included the ratios for all inputs
m = [sk ku; sk2 ku2; sk3 ku3];
end
Thank you in advance!
0 commentaires
Réponses (1)
Ameer Hamza
le 14 Oct 2020
Modifié(e) : Ameer Hamza
le 14 Oct 2020
It depends on the dimensions of the output vectors. If they all have equal lengths, then your approach is correct. However, If they have different lengths, then you will need to use cell arrays
function [m] = matrix(a,b, c)
%ratios calculates skewness and kurtosis ratios
[sk ku] = ratios(y.a);
[sk2 ku2] = ratios(y.b);
[sk3 ku3] = ratios(y.c);
% m is the theoretical output matrix that included the ratios for all inputs
m = {sk ku; sk2 ku2; sk3 ku3};
end
Read about cell arrays:
0 commentaires
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!