Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

51 строка
1.5KB

  1. function prologix_function_generator_waveform(waveform,frequency,amplitude,offset,ipAddress,port)
  2. %PROLOGIX_FUNCTION_GENERATOR Summary of this function goes here
  3. % Detailed explanation goes here
  4. %% test for valid input data
  5. if nargin < 4
  6. offset = 0;
  7. end
  8. switch waveform
  9. case {1,'s','sin','sinus','sinusoid'}
  10. waveform = 'sinusoid';
  11. case {2,'S','sq', 'square'}
  12. waveform = 'square';
  13. case {3,'t','triangle'}
  14. waveform = 'triangle';
  15. case {4,'r','ramp'}
  16. waveform = 'ramp';
  17. otherwise
  18. error('waveform is not correctly defined');
  19. end
  20. switch waveform
  21. case {'square','sinusoid'}
  22. if (1e-04 > frequency) || (frequency > 1.5e07)
  23. error(['frequency is out of range for ',waveform,' waveform (100uHz - 15MHz)']);
  24. end
  25. case {'triangle','ramp'}
  26. if (1e-04 > frequency) || (frequency > 1e05)
  27. error(['frequency is out of range for ',waveform,' waveform (100uHz - 100kHz)']);
  28. end
  29. end
  30. %% start connection with prologix
  31. if nargin < 5
  32. t = prologix_connect();
  33. elseif nargin < 6
  34. t = prologix_connect(ipAddress);
  35. else
  36. t = prologix_connect(ipAddress,port);
  37. end
  38. %%
  39. fprintf(t,'++addr 10');
  40. fprintf(t, ['apply:',waveform,' ',num2str(frequency),',',num2str(amplitude),',',num2str(offset)]);
  41. prologix_disconnect(t);
  42. end