Making a statistics function output a matrix
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Ameer Hamza
il 14 Ott 2020
Modificato: Ameer Hamza
il 14 Ott 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 Commenti
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!