"Roger Stafford" wrote in message <iqssvn$ob1$1@newscl01ah.mathworks.com>...
> "salman " <salmanabdullah9@gmail.com> wrote in message <iqsrio$kfj$1@newscl01ah.mathworks.com>...
> >
> > Dear friends,
> >
> > Have a good day,
> >
> > i am getting this message "Error using times, MD must agree",
> > here are my three lines of code;
> >
> > t=linspace(0,.0000001,200)
> > z=linspace(.0002,.0002,200);
> > Initial_value=(exp((z.^2)./L.^2).*cos(z))./z;
> > E_1=vee_1*(Y(:,3).*t)+initial_value.*(z vee_1*t);%this is where the error comes
> >
> > Y(:,3) is of size 200x1;
> >
> >
> > i dont know why this error comes, as i have checked the syntax and logic, it seems correct to me, yet its giving this error.
> >
> > your help is greatly appreciated.
> >
> > thanks alot
>        
> The multiplication in "(Y(:,3).*t)" is invalid since Y(:,3) is a column vector and t is a row vector. They must be the same size to use ".*". Also you should make sure that "vee_1" is a scalar or you will have other troubles.
>
> Roger Stafford
Dear Roger,
if i change the above equation and replace Y(:,3) by [Y(:,3)]', so now this becomes and row vector. after this however, the previous error is gone, but now i want to create the mesh from t and z and then get surface plot for E(z,t). but it says
Warning: Matrix dimensions must agree, not rendering mesh.
i used this one;
E_1=vee_1*((Y(:,3))'.*t)+Initial_value.*(z t);
meshgrid(t,z);
surf(t,z,E_1)
where;
size(z)=1 200
size(t)=1 200
size(Y(:,3)')=1 200
size(Initial_value)=1 200,
i will be grateful for help.
thanks
