Write Similar Expressions in Arrayfun
1 次查看(过去 30 天)
显示 更早的评论
Is there a concise way to write these 4 expressions so that I don't have to write all of them seperately mayble in a for loop?
n= numel(X);
r_x=1./X; % (X, Y , Z , R are square matrices)
t_x = @(x) sum((x-r_x)./(x+r_x),'all')/n;
x = arrayfun(t_x,r_x);
r_y=1./Y;
t_y = @(x) sum((x-r__y)./(x+r_y),'all')/n;
y = arrayfun(t_y,r_y);
r_z=1./Z;
t_z = @(x) sum((x-r_z)./(x+r_z),'all')/n;
z = arrayfun(t_z,r_z);
r_r=1./R;
t_r = @(x) sum((x-r_r)./(x+r_r),'all')/n;
r = arrayfun(t_r,r_r);
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!