0
$\begingroup$

I have a 3000 x 2301 matrix 'xfinfin' in MATLAB that I want to plot in the following way:

for i=1:2301
    ome = 0.4 + 0.001*(i-1);
    plot(ome,xfinfin(:,i),'k.');
    hold on
end

But this very quickly leads to MATLAB using 100% RAM and an error shows up in the MATLAB commnad line 'Out of memory'.

Basically, this algorithm plots a bifurcation diagram of omega vs x. How do I plot this without MATLAB runnning out of memory?

Thanks.

$\endgroup$
  • 2
    $\begingroup$ I don't have access to MATLAB but even they take some time, in Octave, your codes run without error . I changed the line plot(ome,xfinfin(:,i),'k.'); as plot(ome*ones(3000,1),xfinfin(:,i),'k.'); which makes your codes faster You can try Octave. $\endgroup$ – Ömer Aug 24 '15 at 9:26
  • $\begingroup$ Thank you. That small modification made the code run in Matlab itself without error. $\endgroup$ – zynga Aug 24 '15 at 9:47
  • $\begingroup$ Do you know why this happened? $\endgroup$ – zynga Aug 24 '15 at 9:48
  • $\begingroup$ I don't know exactly but probably the line plot(ome,xfinfin(:,i),'k.') eating so much memory. You can take a look at mathworks.com/help/matlab/matlab_prog/… $\endgroup$ – Ömer Aug 24 '15 at 10:07
0
$\begingroup$

May be you should try stem, its a built-in plot function, I think it is what you need.

$\endgroup$
  • $\begingroup$ Yup, stem works too! $\endgroup$ – zynga Aug 24 '15 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.