defining function which generates 3d array within a class. Different behavior in class versus command window
This code:
lam = @(t) 3*(1 + 0.8*cos(2*pi*t));
A1 = @(t) reshape([lam(t(:).’); lam(t(:).’); zeros(1, numel(t)); lam(t(:).’)], [2, 2, numel(t)]);
tt=0:1/400:1-1/400;
A1stack=A1(tt);
generates a 2x2x400 array. This is what I want to happen. When I embed the code within a class function however, it returns a 2×800 array. How do I fix this?This code:
lam = @(t) 3*(1 + 0.8*cos(2*pi*t));
A1 = @(t) reshape([lam(t(:).’); lam(t(:).’); zeros(1, numel(t)); lam(t(:).’)], [2, 2, numel(t)]);
tt=0:1/400:1-1/400;
A1stack=A1(tt);
generates a 2x2x400 array. This is what I want to happen. When I embed the code within a class function however, it returns a 2×800 array. How do I fix this? This code:
lam = @(t) 3*(1 + 0.8*cos(2*pi*t));
A1 = @(t) reshape([lam(t(:).’); lam(t(:).’); zeros(1, numel(t)); lam(t(:).’)], [2, 2, numel(t)]);
tt=0:1/400:1-1/400;
A1stack=A1(tt);
generates a 2x2x400 array. This is what I want to happen. When I embed the code within a class function however, it returns a 2×800 array. How do I fix this? array function, 3d array, oop MATLAB Answers — New Questions