As octavecontrib points out you have syntax errors in your code, mainly the excess of parenthesis where you should have multiplication operators `*`

or `.*`

, also some confusion in the usage of some functions

going line by line is as it follows

```
t = linspace(0, 12.857);
```

`linspace`

creates regularly linearly-spaced points in an interval, so it requires the specification of `(beginning of interval, ending of interval, number of points)`

, preferably you needed to give a number of points for it to work in a more controlled way, letâ€™s add some points, lets say 50 between [0, 12.857], the code should be:

```
t = linspace(0, 12.857, 50);
```

if you omit the number of points linspace creates 100 points in the interval

```
t = linspace(0, 12.857);
```

now, you seem to be creating some kind of angular parameters by applying some functions to each point of the parameter `t`

like `1.5707 + (0.0873*t.*cos(0.1222*t))`

, but at the same time you are creating a linear space of points for each element resulting from that function application by using the linspace, I donâ€™t know if that should be done that way, again if you omit the desired number of points linspace uses 100, putting the appropriate multiplication operators and deleting the excess of parenthesis the code should be

```
vtheta = linspace(0, (1.5707 + (0.0873*t.*cos(0.1222*t))) );
vphi = linspace(-(1.0995 + (0.0611*t)), (1.0995 + (0.0611*t)) );
vrho = 0.5;
```

now since the result of applying linspace to the functions that uses the `t`

array parameters, create a linear spaced array for each element the result is that `vtheta`

and `vphi`

are matrices instead of vectors so meshgrid also fails to be applied iâ€™m going to omit it

```
% [vtheta, vphi] = meshgrid(vtheta, vphi);
```

then you can already use the spherical to cartesian transformation

```
[x,y,z] = sph2cart(vtheta,vphi,vrho);
surf(x,y,z)
```

The complete corrected code is:

```
t = linspace(0, 12.857);
vtheta = linspace(0, (1.5707 + (0.0873*t.*cos(0.1222*t))) );
vphi = linspace(-(1.0995 + (0.0611*t)), (1.0995 + (0.0611*t)) );
vrho = 0.5;
%[vtheta, vphi] = meshgrid(vtheta, vphi);
[x,y,z] = sph2cart(vtheta,vphi,vrho);
surf(x,y,z)
axis square
axis tight
shading flat
```

i used the parameter `shading flat`

for the surface plot since with 100 points it looks too dense

i would recommend using fewer points, like 50 in each linspace and looking at how it looks with plots like or mesh

you also need to check if this coincides mathematically with what you were trying to do