I am trying to understand how MATLAB performs the following matrix operations:
Example 1:
clearvars; clc; close all;
Vec = fftshift(-Nx/2:Nx/2-1);
Vector1 = (sin( Vec * dx/2)/(dx/2)).^2 ;
Matrix1 = -1 * (Vector1(m))+ Matrix2;
Example 2:
clearvars; clc; close all;
Vec = fftshift(-Nx/2:Nx/2-1);
Vector1 = (sin( Vec * dx/2)/(dx/2)).^2 ;
Matrix1 = -Igl * (Vector1(m))+ Matrix2;
Why is Matrix1 different in Example1 and Example 2? In particular, in Example 1 how is the scalar multiplication of the row vector (Vector1(m)) added to Matrix 2? I am trying to understand the matrix operation done in Example 1 specifically so I can transfer it to C/C++. Thanks