Suggestions for my code
Afficher commentaires plus anciens
Hi all,
I am new to matlab and I have some troubles with my code. I tried to search for some answers but failed. Could anyone give me some suggestions?
clear
[x t]=meshgrid(0:5*10^(-5):200*10^(-5), 0:10:400);
Cxt = 0.0;
for i=0:6,
Cxt = Cxt + (-1)^i*erfc((2*(i+1)*200*10^(-5)-x) / (2*sqrt(t*1.04*10^(-6)))) + (-1)^i*erfc((2*i*200*10^(-7) + x) / (2*sqrt(t*1.04*10^(-6))));
end
mesh(x, t, Cxt)
I just want to have a 3d plot of Cxt, which is a function of x and t. But I always got the warning of "Warning: Matrix is singular to working precision" and no graphic output.
Thanks for help!
Réponses (1)
Matt Fig
le 23 Avr 2011
When doing element-by-element computations, use .* .^ and ./
clear
[x t]=meshgrid(0:5*10^(-5):200*10^(-5), 0:10:400);
Cxt = 0.0;
for i=0:6,
Cxt = Cxt + (-1)^i*erfc((2*(i+1)*200*10^(-5)-x) ./ (2*sqrt(t*1.04*10^(-6)))) + (-1)^i*erfc((2*i*200*10^(-7) + x) ./ (2*sqrt(t*1.04*10^(-6))));
end
mesh(x, t, Cxt)
Catégories
En savoir plus sur Polar Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!