MATLAB Answers

## plot3

Asked by Lisa Justin

### Lisa Justin (view profile)

on 13 Dec 2011
Accepted Answer by Wayne King

### Wayne King (view profile)

how do a plot3 of a wavelet tranform showing time, scale and wavelet coefficients

## Products

No products are associated with this question.

## 3 Answers

### Wayne King (view profile)

Answer by Wayne King

### Wayne King (view profile)

on 14 Dec 2011
Accepted answer

Hi Lisa, To use plot3, you must have your time (position) and scale vectors as matrices because the CWT coefficients are in a matrix.

You can use meshgrid() to transform your time and scale vectors into matrices suitable for plot3()

```t = 1:1024;
a = 1:30;
Wt = abs(randn(30,1024));
[T,A] = meshgrid(t,a);
plot3(T,A,Wt); xlabel('time');
ylabel('Scale'); zlabel('CWT magnitude');
```

However, I think you may find surf() better here

```    surf(t,a,Wt); shading interp;
xlabel('time'); ylabel('scale'); zlabel('CWT magnitude');```

Lisa Justin

### Lisa Justin (view profile)

on 14 Dec 2011

thanks! i will try it now

### Honglei Chen (view profile)

Answer by Honglei Chen

### Honglei Chen (view profile)

on 13 Dec 2011

Hi Lisa,

I don't think plot3 is appropriate for your purpose. I think you probably better off using image or imagesc.

HTH

### Wayne King (view profile)

Answer by Wayne King

### Wayne King (view profile)

on 13 Dec 2011

Hi Lisa, If I remember correctly you are using your own CWT algorithm, not MATLAB's cwt() or cwtft(). Is that correct? Are you coefficients in a matrix scale-position? I think you want surf

```load vonkoch
vonkoch=vonkoch(1:510);
len = length(vonkoch);
cw1 = cwt(vonkoch,1:32,'sym2','plot');
% cw1 is 32x510
surf(1:510,1:32,cw1); shading interp;
xlabel('Position'); ylabel('Scale'); zlabel('CWT Coefficients');
colormap jet;
view([-27 42]);
```

Keep in mind that if you are using a complex-valued analyzing wavelet, you will have to input the moduli (abs()), or the real or imaginary parts.

#### 0 Comments

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

### Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

### MATLAB Academy

New to MATLAB?

Learn MATLAB today!