Azzera filtri
Azzera filtri

What is KSF in matlab?

5 visualizzazioni (ultimi 30 giorni)
Crocodile Fever
Crocodile Fever il 21 Mar 2022
Risposto: Walter Roberson il 21 Mar 2022
WHAT IS KSF
  3 Commenti
John D'Errico
John D'Errico il 21 Mar 2022
help ksf
ksf not found. Use the Help browser search field to search the documentation, or type "help help" for help command options, such as help for methods.
lookfor ksf
sldemo_tanksfun - example animation S-function for model sldemo_tank rfblksfilters1 - Mask function for the RF mathematical filter blocks rfblksfinddialog - Find the dialog for the RF block. rfblksflagnoplot - Set Udata.Plot to false when parameters are invalid.
So KSF is apparently nothing in MATLAB. I suppose possibly a Kalman Filter may be what you are thinking of.
A google search finds these possibilities:
KSF may refer to:
none of which seem terribly pertinent to MATLAB.
John D'Errico
John D'Errico il 21 Mar 2022
Modificato: John D'Errico il 21 Mar 2022
@Crocodile Fever I'm sorry, but please don't post the remainder of your question as an answer. Moved Answer to a comment:
AMPLITUDE MODULATION - DSBFC
Program:
clc;clear all;close all;clf;
t= 0:0.00001:0.01;
Ka=0.1;
c= 10*cos(2*pi*10000*t);
m= 5*cos(2*pi*1000*t);
a=(1+(Ka*m));
s=c.*a;
subplot(611); plot(t,c);
ylabel('Amplitude'); xlabel('time');
title('Carrier Signal');
subplot(612); plot(t,m);
title('Message Signal');
ylabel('Amplitude'); xlabel('time');
subplot(613); plot(t,s);
ylabel('Amplitude'); xlabel('time');
title('AM over modulated Signal');
%%Demodulation using envelope detector technique
[yupper,ylower] = envelope(s);
subplot(614); plot(t,yupper);
ylabel('Amplitude'); xlabel('time');
title('Demodulated Signal using envelope detector');
%%Demodulation using filter function
v=s.*cos(2*pi*10*1000*t);
[b,a]=butter(5,0.2);
y=filter(b,a,v);
subplot(615); plot(t,y);
ylabel('Amplitude'); xlabel('time');
title('demodulated Signal');
%%Frequency spectrum
F=fft(s);
n=length(t);
fshift=(-n/2:n/2-1)*(100000/n);
yshift=fftshift(F);
subplot(616); plot(fshift,abs(yshift));
ylabel('magnitude'); xlabel('frequency');
title('Frequency spectrum of AM Signal');
AMPLITUDE MODULATION AND DEMODULATION-DSBSC
Program:
clc;clear all;close all;clf;
fs=100000;
t= 0:0.00001:0.01;
c= 10*cos(2*pi*10*1000*t);
m= 5*cos(2*pi*1000*t);
s=c.*m;
subplot(511); plot(t,c);
ylabel('Amplitude'); xlabel('time');
title('Carrier Signal');
subplot(512); plot(t,m);
title('Message Signal');
ylabel('Amplitude'); xlabel('time');
subplot(513); plot(t,s);
ylabel('Amplitude'); xlabel('time');
title('DSBSC modulated Signal');
%%Demodulation using synchronous detector
v=s.*cos(2*pi*10*1000*t);
[b,a]=butter(5,0.2);
y=filter(b,a,v);
subplot(514); plot(t,y);
ylabel('Amplitude'); xlabel('time');
title('demodulated Signal');
%%Frequency spectrum
F=fft(s);
n=length(t);
fshift=(-n/2:n/2-1)*(100000/n);
yshift=fftshift(F);
subplot(515); plot(fshift,abs(yshift));
ylabel('magnitude'); xlabel('frequency');
title('Frequency spectrum of DSBSC Signal');
Generation and Demodulation of FM signal using Matlab
Program:
1 clc;clear all;close all;clf;
fs = 10000;%% set the sampling frequency
fc = 100; %% carrier frequency
t = linspace(1,0,10000);
fm=20;%%message signal frequency
fDev =50;%%frequency deviation
x = sin(2*pi*fm*t);%%message signal
y = fmmod(x,fc,fs,fDev);%%modulation of fm
z = fmdemod(y,fc,fs,fDev);%%emodulation of fm
subplot(511); plot(t,sin(2*pi*fc*t));
ylabel('Amplitude'); xlabel('time');
title('Carrier Signal');
subplot(512); plot(t,x);
title('Message Signal');
ylabel('Amplitude'); xlabel('time');
subplot(513); plot(t,y);
ylabel('Amplitude'); xlabel('time');
title('FM modulated Signal');
subplot(514); plot(t,z);
ylabel('Amplitude'); xlabel('time');
title('Demodulated Signal');
%%Frequency spectrum
F=fft(y);
n=length(t);
fshift=(-n/2:n/2-1)*(10000/n);
yshift=fftshift(F);
subplot(515); plot(fshift,abs(yshift));
ylabel('magnitude'); xlabel('frequency');
title('Frequency spectrum of FM Signal');
Generation and Demodulation of
PAM signal using Matlab
Program:
clc;clear all;close all;clf;
Am = 1;
Ac = 2;
fm = 100;
fc = 1000;
t = 0:0.0001:0.03;
y1 = Am*sin(2*pi*fm*t);
y2 =Ac*(square(2*pi*fc*t))+Ac; %square signal
y=y1.*y2; %PAM signal |
subplot(411);
plot(t,y1);
title('message signal');
xlabel('time');
ylabel('amplitude');
grid on;
subplot(412);
plot(t,y2);
title('carrier signal');
xlabel('time');
ylabel('amplitude');
subplot(413);
plot(t,y);
title('PAM signal');
xlabel('time');
ylabel('amplitude');
dem=lowpass(y,100,10000);
dem1=lowpass(dem,100,10000);
dem2=lowpass(dem1,100,10000);
dem3=lowpass(dem2,100,10000);
dem4=lowpass(dem3,100,10000);
dem5=lowpass(dem4,100,10000);
subplot(414);
plot(t,dem5);
title('demodulated signal');
xlabel('time');
ylabel('amplitude');
grid on;
Generation and Demodulation of
PWM signal using Matlab
Program:
clc;clear all;close all;
t = 0:0.001:0.2;
Ac=2 ;
Am=1;
fm = 20 ;
fc = 100;
m = Am.*sin(2*pi*fm*t);
c = Ac.*sawtooth(2*pi*fc*t);
n = length(c);
for i = 1:n
if (m(i)>=c(i))
pwm(i) = 1;
else
pwm(i) = 0;
end
end
%Modulation
subplot(4,1,1);
plot(t,m);
xlabel('Time ----->');
ylabel('Amplitude ----->');
title('Message Signal');
%Carrier signal
c = Ac.*sawtooth(2*pi*fc*t);
subplot(4,1,2);
plot(t,c);
xlabel('Time----->');
ylabel('Amplitude ----->');
title('Carrier Signal');
%PWM modulation
subplot(4,1,3);
plot(t,pwm);
xlabel('Time----->');
ylabel('Amplitude ----->');
title('PWM Signal');
%%Demodulation
y=lowpass(pwm,20,10000);
subplot(4,1,4);
plot(t,y);
xlabel('Time----->');
ylabel('Amplitude ----->');
title('Demodulated Signal');
Generation and Demodulation of
PPM signal using Matlab
Program:
clc;
clear all;
close all;
clf;
fm=50;
fc=500;
fs=5000;
t=0:1:300;
m=0.4*cos(2*pi*fm*t/fs)+0.5;
y=modulate(m,fc,fs,'pwm');
y1=modulate(m,fc,fs,'ppm');
figure
subplot(411);
plot(t,m);
xlabel('TIME(s)');
ylabel('AMPLITUDE(v)');
title('MESSAGE SIGNAL');
axis([0 300 0 1]);
grid on;
% ppm demodulated signal
y2=modulate(m,fc,10*fs,'ppm');
z=demod(y2,fc,10*fs,'ppm');
subplot(414);
plot(z);
xlabel('TIME(s)');
ylabel('AMPLITUDE(v)');
title('PPM DEMODULATED SIGANL');
axis([0 300 0 1]);
grid on;
subplot(412);
plot(y)
hold on
xlabel('TIME(s)');
ylabel('AMPLITUDE(v)');
title('PWM MODULATION');
grid on;
axis([0 500 -0.2 1.5])
subplot(413);
plot(y1);
axis([0 500 -0.2 1.5])
xlabel('TIME(s)');
ylabel('AMPLITUDE(v)');
title('PPM Modulation');
grid on;
Companding - Implementation of
A-law and μ-law using Matlab
Program:
A law:
clc;clear all;close all;clf;
t=0:0.01:1;
m= 2.*sin(t);
mp = max(m);
x1=m/mp;
x=abs(x1);
title('A-law');
k=1;
for a=[1 10 20 50 87.6 100]
if le(x,(1/a))
y(k,:)= ((a/(1+log(a)).*x1));
else
y(k,:)= ((sign(m)./(1+log(a))).*(1+log(a.*x)));
end
k=k+1;
end
figure;
plot(x1,y(1,:),'kd-');
hold on
plot(x1,y(2,:),'k*-');
hold on
plot(x1,y(3,:),'k+-');
hold on
plot(x1,y(4,:),'kx-');
hold on
plot(x1,y(5,:),'kv-');
hold on
plot(x1,y(6,:),'ks-');
hold on
axis([0 1 0 1]);
xlabel('m/mp');ylabel('y');
legend('A=1','A=10','A=20','A=50','A=87.6','A=100');
M-law:
clc;clear all;close all;clf;
f=10;
t=0:.0001:10;
m=sin(2.*pi.*f.*t);
mp=max(m);
x1=m/mp;
x=abs(x1);
k=1;
for u1=[1 10 50 100 1000]
y(k,:)=sign(m).*((log(1+(u1.*x)))/(log(1+u1)));
k=k+1;
end
figure;
plot(x1,y(1,:),'kd-');
hold on
plot(x1,y(2,:),'k*-');
hold on
plot(x1,y(3,:),'k+-');
hold on
plot(x1,y(4,:),'kx-');
hold on
plot(x1,y(5,:),'kv-');
hold on
xlabel('m/mp');ylabel('y');
axis([0 1 0 1]);
legend('u=1','u=10','u=50','u=100','u=100');
end
Sampling and Reconstruction using Matlab
Program:
clear,clc,close all;
fm = 10; % frequency of signal [Hz]
fs = 10*fm %2*fm; % sampling rate [Hz]
Ts = 1/fs; % sampling period [sec]
nc = 4; %number of cycles of message
tc = 0:0.0001:nc/fm;
xc = cos(2*pi*fm*tc);%message
td = 0:1/fs:nc/fm;
xd = cos(2*pi*fm*td);%sampled
N = length(td);
xr = zeros(size(tc));
sinc_train = zeros(N,length(tc));
for t = 1:length(tc)
for n = 0:N-1
sinc_train(n+1,:) = sin(pi*(tc-n*Ts)/Ts)./(pi*(tc-n*Ts)/Ts);
theta = pi*(tc(t)-n*Ts)/Ts;
xr(t) = xr(t) + xd(n+1)*sin(theta)/theta;
end
end
%%Plot the results
figure;
grid on
subplot(311); plot(tc,xc)%ct signal
xlabel('Time [sec]')
ylabel('Amplitude')
title('Input signal')
subplot(312); stem(td,xd)%dt signal
xlabel('Time [sec]')
ylabel('Amplitude')
title('Sampled signal')
subplot(313); plot(tc,xr)
xlabel('Time [sec]')
ylabel('Amplitude')
title('Reconstructed signal')
%% Sinc train visualization
figure;
hold on
grid on
plot(tc,xd.'.*sinc_train)
stem(td,xd)
xlabel('Time [sec]')
ylabel('Amplitude')
Generation and Demodulation of
ASK signal using Matlab
Program:
close all;
clear all;
t = 0:1:1000;
fc = 1000;
fs = 10000;
fm = 100;
Ac = 2;
c = Ac * cos(2*pi*fc/fs*t);
m = 0.5*(square(sin(2*pi*fm/fs*t)) + 1);
wave = c.*m;
subplot(411); plot(t, m);
xlabel('Time')
ylabel('Amplitude')
title('Message')
subplot(412); plot(t, c);
xlabel('Time')
ylabel('Amplitude')
title('Carrier')
subplot(413); plot(t, wave);
xlabel('Time')
ylabel('Amplitude')
title('Modulated Wave')
% Demod
d = wave .* c;
ld = lowpass(d, fc/10, fs);
for i = 1:1001
if(abs(ld(i)) > 1)
dem(i) = 1;
else
dem(i) = 0;
end
end
subplot(414);
plot(t, dem);
xlabel('Time')
ylabel('Amplitude')
title('Demodulated Wave')
Generation and Demodulation of
FSK signal using Matlab
Program:
close all
clear all
fc1=20;
fc2=50;
fp=5;
fs=500;
amp= 4;
t=0:0.001:0.5;
c1=amp.*sin(2*pi*fc1*t);
c2=amp.*sin(2*pi*fc2*t);
subplot(5,1,1);
plot(t,c1); xlabel('Time'); ylabel('Amplitude'); title('Carrier 1 Wave')
subplot(5,1,2)
plot(t,c2); xlabel('Time'); ylabel('Amplitude'); title('Carrier 2 Wave')
m=amp.*square(2*pi*fp*t)+amp;
subplot(5,1,3); plot(t,m); xlabel('Time'); ylabel('Amplitude'); title('Binary Message Pulses')
for i=0:500
if m(i+1)==0
mm(i+1)=c1(i+1);
else
mm(i+1)=c2(i+1);
end
end
subplot(5,1,4)
plot(t,mm)
xlabel('Time')
ylabel('Amplitude')
title('Modulated Wave')
%%demodulation
N1=length(t);
for j=1:N1
if mm(j)==c2(j)
y2(j)=1;
else
y2(j)=0;
end
end
subplot(5,1,5)
plot(t,y2)
xlabel('Time')
ylabel('Amplitude')
title('DeModulated Wave')
Generation and Demodulation of
PSK signal using Matlab
Program:
clc,close all,clear all,clf;
t = 0:1:300;
fc = 1000;
fs = 10000;
fm = 100;
Ac = 2;
c = Ac * sin(2*pi*fc/fs*t);
m = square(sin(2*pi*fm/fs*t)) ;
p = c.*m;
subplot(411); plot(t, m);
xlabel('Time')
ylabel('Amplitude')
title('Message signal')
subplot(412); plot(t, c);
xlabel('Time')
ylabel('Amplitude')
title('Carrier signal')
subplot(413); plot(t, p);
xlabel('Time')
ylabel('Amplitude')
title('PSK Modulated Wave')
%%Demodulation
d = p .* c;
ld = lowpass(d, fc/10, fs);
for i = 1:301
if(ld(i)> 0)
dem(i) = 1;
else
dem(i) = 0;
end
end
subplot(414);
plot(t, dem);
xlabel('Time')
ylabel('Amplitude')
title('Demodulated Wave')

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 21 Mar 2022
FSK means Frequency Shift Keying.

Categorie

Scopri di più su Get Started with Signal Processing Toolbox in Help Center e File Exchange

Tag

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by