How to plot an elliptic pde without using pdetool in matlab?

172 views Asked by At

Basically I want to plot this without using pdetool which is

-div(cgrad(u))+au=f

Where a=0, c=1.0,f=10 Here I am having problem to use divergence(). It gives an error. For the time being I have written this code, though it works it doesn't give exactly what I expected.

a = 0.0; c = 1.0; f = 10; time = 100;

for step = 1:time    
    u = rand(50,50);    
    v = gradient(u);    
    f = -gradient(c*v)+a*u;

    %---------- show results    
    pcolor(f); 
    shading interp;    
    colorbar;
    colormap hsv;    
    drawnnow;    
end

Please help me to find a better solution with proper use of divergence. I want to study the chaotic behavior from it.

0

There are 0 answers