Matlab IO Chirp Signal

Hi,
Forgive my ignorance i am new to this, and i have done a few (unsuccessful) searches to try and solve this.

i am trying to output a chirp signal from my arduino mega pwm out, from maltab. however i cannot put a function as the output. I have tried to use a for loop to solve this but have come to no avail!
any help or suggestions would be much appreciated. the code i have tried to use is as follows.

clear all; clc;

%connect board

a = arduino('/dev/cu.usbserial-A9007LCD')

%specify pin modes

a.pinMode(3,'output');

t = [0:0.01:10];

ch = chirp(t,0.0001,10,10);

for i = 0:numel(ch)

a.analogWrite(3,ch(i,:))
pause(0.01)

end

Thanks very much

Ran

Anyone??

solved