Clear Filters
Clear Filters

how can i multiply two large arrays of different sizes?

6 views (last 30 days)
I'm trying to figure out how to get a value for k when I have two variables w and t that are of different sizes.
sigma = 0 %can set sigma to any positive integer number but choosing 0 to simplify things for now
w = (0:2*pi:30000*pi) % required parameters
z = sigma + 1i.*w %gives me a complex array of 1x15001 using the values of w above.
dt=1/44000; %my sample rate is 44000
t = 0:dt:2 %gives me an array of 1x88001
k = exp(-z.*t); %this is where my problem comes in because i can't multiply two arrays of different sizes

Answers (1)

Chunru
Chunru on 6 Aug 2021
sigma = 0 %can set sigma to any positive integer number but choosing 0 to simplify things for now
sigma = 0
w = (0:2*pi:10*pi) % required parameters (small value for illustration)
w = 1×6
0 6.2832 12.5664 18.8496 25.1327 31.4159
z = sigma + 1i.*w %gives me a complex array of 1x15001 using the values of w above.
z =
0.0000 + 0.0000i 0.0000 + 6.2832i 0.0000 +12.5664i 0.0000 +18.8496i 0.0000 +25.1327i 0.0000 +31.4159i
dt=1/44000; %my sample rate is 44000
t = 0:dt:4*dt; %gives me an array of 1x88001 (smaller size)
t = 1×5
1.0e+-4 * 0 0.2273 0.4545 0.6818 0.9091
% k is a matrix k(i_z, i_t). I guess this is what you want
k = exp(-z.'*t)
k =
1.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 + 0.0000i 1.0000 - 0.0001i 1.0000 - 0.0003i 1.0000 - 0.0004i 1.0000 - 0.0006i 1.0000 + 0.0000i 1.0000 - 0.0003i 1.0000 - 0.0006i 1.0000 - 0.0009i 1.0000 - 0.0011i 1.0000 + 0.0000i 1.0000 - 0.0004i 1.0000 - 0.0009i 1.0000 - 0.0013i 1.0000 - 0.0017i 1.0000 + 0.0000i 1.0000 - 0.0006i 1.0000 - 0.0011i 1.0000 - 0.0017i 1.0000 - 0.0023i 1.0000 + 0.0000i 1.0000 - 0.0007i 1.0000 - 0.0014i 1.0000 - 0.0021i 1.0000 - 0.0029i

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!