loops in matlab, plotting matrix elements
I want to perform the following summation numerically:
where t and x are parameters with respect to which I will subsequently plot the results
x is between -C and C, and t is between -K and K for some positive constants C, K
I would like to get a matrix r, whose columns are the summation values for fixed t and whose rows the summation values for fixed x.
Here's my attempt for K = C = 10 and N = 5, but it fails :( - I only get a single number r.
The plots I want are for r(t), r(x) the other variable being fixed, respectively, and a polar plot for r(x,t). Does anyone know how to read off and plot a column/row from a matrix?
for t = -10:0.1:10;
for x = -10:0.1:10;
for p = -5:1:5;
A = 2.*cos(p*t).*cos(p*x).*exp(-p.^2);
r = sum(A);
Thanks a lot!