New Reply

How do I preallocate memory in MATLAB...

 
Share Thread Thread Tools
Jan22-12, 03:04 AM   #1
 

How do I preallocate memory in MATLAB...


1. The problem statement, all variables and given/known data

I get the error that the variable changes size with each loop iteration then it suggests that I preallocate memory to overcome this. How would I do that?

2. Relevant equations

none

3. The attempt at a solution


here is my code


t=0:0.5:5;
y(1)=1;
for i = 1:10
y(i+1) = y(i)+ (t(i)^2*0.5);
end

thanks for the help
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> Galaxies fed by funnels of fuel
>> The better to see you with: Scientists build record-setting metamaterial flat lens
>> Google eyes emerging markets networks
New Reply
Thread Tools


Similar Threads for: How do I preallocate memory in MATLAB...
Thread Forum Replies
Comsol Matlab memory usage Math & Science Software 1
MATLAB - how to increase memory? Math & Science Software 0
matlab memory issues Programming & Comp Sci 0
A number in matlab by default uses how much memory? Math & Science Software 1
A number in matlab by default uses how much memory? Engineering, Comp Sci, & Technology Homework 1