Conect arduino to matlab

Hi every one
I want to conect matlab tk arduino when the arduino is working including reading sensor value and PWM of a 12V fan. I have a seperate voltage supply for fan and the GND of fan and arduino is same and it works well but when I conect to pc by usb cable, i dont give arduino any voltage from 12V or 5V regulator and the pc give the voltage, I only conect the gnd of arduino to fan or adaptor but the fan dosent work

It would be much easier to help you include a schematic. The wiring the fan interface circuit is probably where the problem is. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil

here is the wiring circuit

the usb cable is connected to arduino and sensor supply is given by arduino