eeecoder.blogspot.com

hi, in this post I wanna tell you about a new and more active blog which is eeecoder. In this new blog the topics or categories are:

Linux
Matlab
Python
Latex
Firefox
Blogger
Android
C/C++.

If you give a minute to review and observe  this blog you can see it’s really good with its posts and articles. It includes some common problems and their solutions with proofs in its posts and articles. Have a good day 🙂

A Traveling Wave by Making an Animation in MATLAB

clc %clears the command window
clear %clears variables
%Variables:
%Eo
wave amplitude (V/m)
%f
frequency (Hz)
%omega
angular frequency (rad/s)
%t
time snapshot
%c
speed of light
%z
position
%E
Electric Field Intensity
%B
phase constant (1/m)
%phi
phase constant (s)
%phir
phase constant (radians)
%lambda
wavelength
(m)
%Initial Values of Variables:
f=1000;
phi=0;
c=2.998e8;
lambda=c/f;
t=1;
phir=phi*pi/180;
Eo=1;
B=2*pi/lambda;
omega=2*pi*f;
z=0:4*lambda/100:4*lambda;
E=Eo*cos(omega*t-B*z+phir);
plot(z,E)
axis([0 4*lambda -2*Eo 2*Eo])
grid
xlabel(‘z(m)’)
ylabel(‘E(V/m)’)
pause
t=0:1/(40*f):1/f;
for n=1:40;
E=Eo*cos(omega*t(n)-B*z+phir);
plot(z,E)
axis([0 4*lambda -2*Eo 2*Eo])
grid
title(‘General Wave Equation’);
xlabel(‘z(m)’);
ylabel(‘E(V/m)’);
M(:,1)=getframe;
end

After that I run it from the command window. I give three figures these are in different time to
see properly the wave is travelling.

1.jpg 2.jpg 3.jpg

Modelling a Digital Communication System using Matlab

READ IN MY NEW BLOG WITH UPDATES!
A digital telephone converts an analog signal(our voice) to a digital signal before transmission. While the analog signal takes on real number values, the digital signal takes on only a finite set of integer

values. We can model these implementation effects and save memory by storing the digital as
an integer data type rather than as type double. We did this by using the script in the
following.

%% ====== Sources ======
% Load sampled (discretized time) analog sources
% with double values between -1 and +1.
load phonecalls
% See and hear both sources together.
% Note source clipping at -1 and +1.
plot(source1,’r’)
hold on
plot(source2,’b’)
ylabel(‘DOUBLE Values’)
title(‘{\bf Analog Sources}’)
legend(‘Source 1′,’Source 2’)
soundsc([source1,source2],Fs) % Stereo
pause(4)
%% ====== Source coding (quantization) ======
% Digital signals (discretized values) with scaled
% and quantized int8 values between -128 and 127.
sig1 = int8(128*source1);
sig2 = int8(128*source2);
% See and hear both signals together.
% Clipped values at -1 and +1 in the sources
% saturate in the signals at -128 and 127.
figure
plot(sig1,’r.’)
hold on
plot(sig2,’b.’)
ylabel(‘INT8 Values’)
title(‘{\bf Digital Signals}’)
legend(‘Signal 1′,’Signal 2’)
soundsc([double(sig1),double(sig2)],Fs) % Stereo
——
As you see from the script I plotted the analog sources and the digital signals seperately. The
plot are shown in Figures. Any other necessary explanations is in the comments in the
script.
I want to speak about some functions and commands these are we used in the script above.
load: load workspace variables from disk.
soundsc: Scale data and play as sound.
pause: Halt execution temporarily.
int8: Stored integer value of fi object as built-in int8
digital_communication_system_figure1
new