data aqusition toolbox,an error

2 vues (au cours des 30 derniers jours)
osman yurdakul
osman yurdakul le 27 Mai 2011
[EDIT: 20110527 07:57 CDT - reformat - WDR]
clear all;clc;close all
f_signal = 40000; % Orneklenecek isaretin frekansi
T_signal = 1 / f_signal; % Orneklenecek isaretin periyodu
f_sample = 160000;% Ornekleme frekansi
T_sample = 1/f_sample;% Ornekleme periyodu
T_bit = 2*power(10,-3);% Saniye cinsinden bit suresi
T_frame = 1;% Bir cercevenin saniye cinsinden suresi
blank = 276;%Frame'e 20 bit suresi kadar bosluk konacak
barker_code_lenght = 13;
rate = 1 / T_bit; % Saniyede iletilen sembol sayisi
data_length = T_frame/T_bit - 1 - blank - barker_code_lenght;
A_signal = 1;% Tasiyici isaretin genligi
sample_number_per_bit = T_bit * f_sample;
h = [1 1 1 1 1 -1 -1 1 1 -1 1 -1 1];
h_barker = fliplr(h);
N = sample_number_per_bit;
h_barker2 = reshape(repmat(h_barker,N,1),1,N*length(h_barker));
AI = analoginput('nidaq','Dev1');
set(AI,'InputType','SingleEnded');
chans = addchannel(AI,8);
set(AI,'SampleRate',f_sample)
set(AI,'SamplesPerTrigger', f_sample*5);
set(AI,'TriggerType','Manual');
set(AI,'ManualTriggerHwOn', 'Trigger');
start(AI)
trigger(AI)
r = getdata(AI);
stop(AI);
r = r - 4.24;
t = 0:T_sample:5*T_frame-T_sample;
r1 = r.*cos(2*pi*f_signal*t');
r2 = -1i*r.*sin(2*pi*f_signal*t');
rp = r1 + r2;
rp_conv = conv(rp,h_barker2);
rp_conv2 = abs(rp_conv);
[max_rp_conv2,n] = max(rp_conv2);
R2 = r(n-length(h)*320:end);
R3 = R2(length(h)*320+1:end);
R4 = R3(1:(data_length+1)*320);
% % % % % % % % % % DEMODULATION % % % % % % % % % % % %
t = 0:T_sample:(data_length + 1) * T_bit-T_sample;
Y1 = R4' .* cos(2*pi*f_signal*t);
Y2 = -1i*R4' .* sin(2*pi*f_signal*t);
y1 = sum(reshape(Y1,320,211));
y2 = sum(reshape(Y2,320,211));
y = y1 + y2;
decision = real( y(2:end) .* conj(y(1:end-1))) < 0;
received_string = sprintf('%i',decision)
word_phrase_receiver = char(bin2dec(reshape(received_string,7,[]).')).'
when i run this code, i get an error like
??? proje_uygulama_alıcı
|
Error: The input character is not valid in MATLAB statements or expressions.
how can i deal with this situation? what i do wrong?
please help me...

Réponse acceptée

Walter Roberson
Walter Roberson le 27 Mai 2011
You appear to have saved the code in a file named "proje_uygulama_alıcı.m" . That name contains the character "ı" which is not one of the Latin characters (upper or lower case) or one of the digits or an underscore. Filenames for scripts or functions must obey the same rules as MATLAB identifiers. You will have to replace the "ı" with some other character.
  1 commentaire
osman yurdakul
osman yurdakul le 27 Mai 2011
thanks. how stupid i am :) :S thanks again...

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by