Matlab cannot give the 3d surface plot of the following program.Matlab gives the value of all the variables in matrix form. But it cacnot plot the 3d graph using surf command. Why matlab cannot plot a 3d graph using 'surf' command in symbolic variable?? pls help me....
clear all
close all
clc
syms r
c=1;
for R=0.01:0.01:0.03
R1(c)=R;
j=1;
for l=0.3:0.01:0.4
l1(j)=l;
A=l*exp(-r^2);
B=int(A,0,inf);
B1(c,j)=B;
j=j+1;
end
c=c+1;
end
B1=real(B1)
surf(R1,l1,B1')

surfandmeshfunctions. I thought that by looking at this function you would understand howsurfworks. Next to understand why you calculate the same integral 3 times and then calculate it 30 times more with different offset. If this was solved all indexing problems that likely will appear from a loop, would go away. The symbol issue would still be there though... - patrikRseems quite random. R is not a part of the integral or any part of the code except plotting. Why integrate overrfrom0toinfand then plot it forR. It seems you tries to do something else. Is the main problem that you want to plot the integral ofe^(-r^2)for the values ofR1andl1or do you even want to plote^(-(x^2+y^2))? - patrik