From: Naser Tbakh on
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',...
>



i got an answer from us but i am new to matlap can fix it

can any body fix and rewrite the code
From: Wayne King on
"Naser Tbakh" <natdonat(a)hotmail.com> wrote in message <hvr7ik$5r1$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',...
> >
>
>
>
> i got an answer from us but i am new to matlap can fix it
>
> can any body fix and rewrite the code

Hi Naser, Us tried to help you debug your code in his reply. The general rule here is that people do not give people the answers to their homework problems.

People also tend to not be sympathetic to requests for others to simply rewrite their code for them.

One of the immediate issues that you have is that you are trying to do pulse amplitude modulation, but there is a function in the Bioinformatics Toolbox that computes a Point Accepted Mutation (PAM) scoring matrix. You are trying to call that function.

I think you should take some time and read the Matlab Getting Started Guide.

Wayne
From: TideMan on
On Jun 23, 8:48 am, "Naser Tbakh" <natdo...(a)hotmail.com> wrote:
> 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',...
>
> i got an answer from us but i am new to matlap can fix it
>
> can any body  fix and rewrite the  code

I hope you are not sitting there desperately waiting for someone to
pull you out of the hole you've gotten yourself into, because it is
not going to happen.
No one here cares that you have left it until the last minute and are
now panicking.
Hopefully, you will learn from this that procrastination does not pay.