Reputation: 59
Relevant code:
Hf = ((j*2*pi*f).^2 + Wo.^2)/((j*2*pi*f).^2 + 2*Wo*j*2*pi*f + Wo.^2);
It runs out of memory on the Hf = ' ' line. The only non-numerical part of this statement is the f term. Typing in the command window :
size(f)
ans = 65536 1
I'm not used to MATLAB at all, but I don't think this is something I can fix by freeing up memory before I make that statement.
Here's the memory after getting the error:
Maximum possible array: 10096 MB (1.059e+10 bytes) *
Memory available for all arrays: 10096 MB (1.059e+10 bytes) *
Memory used by MATLAB: 3716 MB (3.896e+09 bytes) Physical Memory (RAM): 8173 MB (8.570e+09 bytes)
- Limited by System Memory (physical + swap file) available.
Here it is before (after I hit >>clear all)
Maximum possible array: 10095 MB (1.059e+10 bytes) *
Memory available for all arrays: 10095 MB (1.059e+10 bytes) *
Memory used by MATLAB: 3693 MB (3.872e+09 bytes)
Physical Memory (RAM): 8173 MB (8.570e+09 bytes)
- Limited by System Memory (physical + swap file) available.
I tried restarting MATLAB -- No luck
Upvotes: 0
Views: 321
Reputation: 308
The part before /
is a column vector (of 65536) elements, as well as the part after that. I guess you wanted to do elementwise division - in such a case, use ./
.
This way, the backslash operator, "dividing" given vectors, creates a matrix with 65536*65536 elements, so it is not surprising that there is a problem with memory.
Upvotes: 5