Prev: get my plp
Next: plp
From: Naser Tbakh on 22 Jun 2010 15:07 i have a proplem in this cood plz help can not do PAM (PULSE AMPLITUDE MODULATION ) SEE >> %data fs = 8000; ts=1.25e-4; pulse_duration = 5e-5; % sinusoidal sgnal; td=1.25e-5; fd=80000; t=(0:td:100*td); fm=10000; s=sin(fm*t); %PAM signal generation pam_s=pam(s,td,ts,pulse_duration); figure(1);hold on plot(t,s); plot(t(1:length(pam_s)),pam_s); xlabel('time') ylabel('magnitude') legend('signal','PAM-signal'); % Coputing magnitude spectrum S(f) a=((abs(fft(pam_s)).^2)); a=a/max(a); f=fs*(fs/fd:fs*(fs/fd):(length(a))*fs*(fs/fd)); figure(2) plot(f,a); xlabel('time') ylabel('magnitude') %finding zeros index=find(a<1e-5); % The firest zero fprintf('Envelopes gose through zero for the firest time = %6d\n' , min (index)*fs*(fs/fd)) function pam_s=PAM(s,td;ts;pulse_duration); potd= pulse_duration/td; tsotd=ts/td; y=zeros(1,length(s)); tt=1:(tostd):length(tt); y(tt(kk):tt(kk)+potd-1)=s(tt(kk)).*ones(1,potd); pam_s=y(1:lenghth(s)-potd); ??? Error using ==> error Formatted arguments cannot be non-scalar numeric matrices. Error in ==> pam at 41 error('Bioinfo:InvalidBlosumN',...
From: us on 22 Jun 2010 15:17 "Naser Tbakh" <natdonat(a)hotmail.com> wrote in message <hvr1l9$3pk$1(a)fred.mathworks.com>... > i have a proplem in this cood plz help > > can not do PAM (PULSE AMPLITUDE MODULATION ) SEE > > >> %data > fs = 8000; > ts=1.25e-4; > pulse_duration = 5e-5; > > % sinusoidal sgnal; > td=1.25e-5; > fd=80000; > t=(0:td:100*td); > fm=10000; > s=sin(fm*t); > > %PAM signal generation > pam_s=pam(s,td,ts,pulse_duration); > > figure(1);hold on > > plot(t,s); > plot(t(1:length(pam_s)),pam_s); > xlabel('time') > ylabel('magnitude') > legend('signal','PAM-signal'); > > > % Coputing magnitude spectrum S(f) > a=((abs(fft(pam_s)).^2)); > a=a/max(a); > f=fs*(fs/fd:fs*(fs/fd):(length(a))*fs*(fs/fd)); > > figure(2) > plot(f,a); > xlabel('time') > ylabel('magnitude') > > %finding zeros > index=find(a<1e-5); > > % The firest zero > fprintf('Envelopes gose through zero for the firest time = %6d\n' , min (index)*fs*(fs/fd)) > > function pam_s=PAM(s,td;ts;pulse_duration); > > potd= pulse_duration/td; > tsotd=ts/td; > y=zeros(1,length(s)); > tt=1:(tostd):length(tt); > y(tt(kk):tt(kk)+potd-1)=s(tt(kk)).*ones(1,potd); > > pam_s=y(1:lenghth(s)-potd); > ??? Error using ==> error > Formatted arguments cannot be non-scalar numeric matrices. > > Error in ==> pam at 41 > error('Bioinfo:InvalidBlosumN',... > one of the solutions % in the command window dbstop if error; % run your code % it will stop, open the file, and put your cursor at the offending location % now inspect all the inputs, eg, POTD,... % if everything works... dbclear all; us
From: Naser Tbakh on 22 Jun 2010 16:06 "us " <us(a)neurol.unizh.ch> wrote in message <hvr284$col$1(a)fred.mathworks.com>... > "Naser Tbakh" <natdonat(a)hotmail.com> wrote in message <hvr1l9$3pk$1(a)fred.mathworks.com>... > > i have a proplem in this cood plz help > > > > can not do PAM (PULSE AMPLITUDE MODULATION ) SEE > > > > >> %data > > fs = 8000; > > ts=1.25e-4; > > pulse_duration = 5e-5; > > > > % sinusoidal sgnal; > > td=1.25e-5; > > fd=80000; > > t=(0:td:100*td); > > fm=10000; > > s=sin(fm*t); > > > > %PAM signal generation > > pam_s=pam(s,td,ts,pulse_duration); > > > > figure(1);hold on > > > > plot(t,s); > > plot(t(1:length(pam_s)),pam_s); > > xlabel('time') > > ylabel('magnitude') > > legend('signal','PAM-signal'); > > > > > > % Coputing magnitude spectrum S(f) > > a=((abs(fft(pam_s)).^2)); > > a=a/max(a); > > f=fs*(fs/fd:fs*(fs/fd):(length(a))*fs*(fs/fd)); > > > > figure(2) > > plot(f,a); > > xlabel('time') > > ylabel('magnitude') > > > > %finding zeros > > index=find(a<1e-5); > > > > % The firest zero > > fprintf('Envelopes gose through zero for the firest time = %6d\n' , min (index)*fs*(fs/fd)) > > > > function pam_s=PAM(s,td;ts;pulse_duration); > > > > potd= pulse_duration/td; > > tsotd=ts/td; > > y=zeros(1,length(s)); > > tt=1:(tostd):length(tt); > > y(tt(kk):tt(kk)+potd-1)=s(tt(kk)).*ones(1,potd); > > > > pam_s=y(1:lenghth(s)-potd); > > ??? Error using ==> error > > Formatted arguments cannot be non-scalar numeric matrices. > > > > Error in ==> pam at 41 > > error('Bioinfo:InvalidBlosumN',... > > > > one of the solutions > > % in the command window > dbstop if error; > % run your code > % it will stop, open the file, and put your cursor at the offending location > % now inspect all the inputs, eg, POTD,... > % if everything works... > dbclear all; > > us thanx for help me but i am new to matlap i know it is hard for but can you fix it and give me the final code plz this is i think the error if ~ismember(N,possibleN) error('Bioinfo:InvalidBlosumN',... 'PAM%d does not exist. Valid numbers are 10:10:500.',N);
|
Pages: 1 Prev: get my plp Next: plp |