Array operations- vectorization. Error with matrix dimensions.
显示 更早的评论
Hi! Sorry if it's stupid question, but I'm newbie with MATLAB. I wanted to use vectorization in my function which applies forward mapping (affine transformation of 2D image). I found vectorization in MATLAB documentation https://www.mathworks.com/help/matlab/matlab_prog/vectorization.html?requestedDomain=true#btjk57v-1 . The problem is I wanted to try the example stated there under the topic of array operations.
x = (-2:0.2:2)'; % 21-by-1
y = -1.5:0.2:1.5; % 1-by-16
F = x.*exp(-x.^2-y.^2); % 21-by-16
And the error appeared: Error using - Matrix dimensions must agree. What can be a problem here? It is example from documentation, so I'm kinda confused why it is not working for me.
采纳的回答
更多回答(1 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!