|
On Nov 12, 9:31=A0am, "Gerry Puckett" <egpuck...@ucdavis.edu> wrote:
> I am having difficulty understanding the syntax of defining a function th=
at - from the point of view of MATLAB - is really an array of values of tha=
t function.
>
> So for example,
>
> % c(x) is the circle that passes through (x_l, y_l) and (x_r, y_r)
> % and has center (x_c, y_c) and radius R.
>
> zmin =3D x_c;
> zmax =3D x_c + R;
>
> dz =3D 1/1000;
> z =3D zmin : dz : zmax;
>
> c =3D y_c - sqrt( R^2 - (z - x_c).^2 );
>
> plot(z, c, 'r');
>
> produces the plot of the portion of the circle that I want. =A0However, n=
ow I want to plot the second derivative of c(x) over the same interval and =
I've tried
>
> cpp =3D R*R / (sqrt( R^2 - (z - x_c).^2 )).^3;
>
> and a number of other expressions to no avail. =A0I apparently don't unde=
rstand the syntax ".^" and a number of other things about =A0MATLAB. =A0(I'=
m an old hand at FORTRAN and a variety of other computer languages and it s=
eems that I should be able to
> define a function
>
> function cpp(z) =3D R*R / (sqrt( R^2 - (z - x_c)^2 ))^3;
>
> and either implicitly or explicitly loop over the values of z and plot th=
e pair (z, cpp(z)). =A0However, I haven't found the appropriate part of MAT=
LAB help that shows me how to do this.
>
> I do have the symbolic toolbox, if that is the only way to accomplish wha=
t I want. =A0However, it seems logical that MATLAB must have a way to plot =
something as straight forward as , for example
>
> =A01/ sqrt( R^2 - (z - x_c)^2 ))^3;
>
> Thanks for your help!
Missing one more dot, should be dot-divide
cpp =3D R*R ./ (sqrt( R^2 - (z - x_c).^2 )).^3;
cheers,
Richard
^^^
|