search for: result_matlab

Displaying 3 results from an estimated 3 matches for "result_matlab".

2024 Feb 27
4
converting MATLAB -> R | element-wise operation
...or someone to explain. Basically, trying to 'line up' MATLAB results from an element-wise division of a matrix by a vector with R output. Here is a simplified version of the MATLAB code I'm translating: NN = [1, 2, 3; 4, 5, 6];? % Example matrix lambda = [2, 3, 4];? % Example vector result_matlab = NN ./ lambda; which yields ?0.50000?? 0.66667?? 0.75000 ?2.00000?? 1.66667?? 1.50000 So, the only way I have stumbled onto in R to generate the same results is to use 'sweep'. The following 'works', but I'm hoping someone can explain why I need something as convoluted...
2024 Feb 27
2
[External] converting MATLAB -> R | element-wise operation
...y, trying to 'line up' MATLAB results from an element-wise > division of a matrix by a vector with R output. > > Here is a simplified version of the MATLAB code I'm translating: > > NN = [1, 2, 3; 4, 5, 6]; % Example matrix > lambda = [2, 3, 4]; % Example vector > result_matlab = NN ./ lambda; > > which yields > > 0.50000 0.66667 0.75000 > 2.00000 1.66667 1.50000 > > > So, the only way I have stumbled onto in R to generate the same results > is to use 'sweep'. The following 'works', but I'm hoping someone can > e...
2024 Feb 27
2
converting MATLAB -> R | element-wise operation
...cally, trying to 'line up' MATLAB results from an element-wise >division of a matrix by a vector with R output. > >Here is a simplified version of the MATLAB code I'm translating: > >NN = [1, 2, 3; 4, 5, 6];? % Example matrix >lambda = [2, 3, 4];? % Example vector >result_matlab = NN ./ lambda; > >which yields > > ?0.50000?? 0.66667?? 0.75000 > ?2.00000?? 1.66667?? 1.50000 > > >So, the only way I have stumbled onto in R to generate the same results >is to use 'sweep'. The following 'works', but I'm hoping someone can >exp...