Showing posts with label matlab. Show all posts
Showing posts with label matlab. Show all posts

Saturday, December 14, 2013

Transmission Line Analysis Using Matlab

Matlab has a Radio Frequency Toolbox(rf toolbox). Using this toolbox matlab allows us to do some simulation and calculations about transmission lines, active components, RLC components, black box elements etc. In this post we are going to analyze a microstripline using 'rfckt.microstrip' class in the matlab.

Let's calculate characteristic impedance of a microstrip line at 1Ghz, 2Ghz and 3Ghz with the given specifications below:

thickness = 5.000e-09
width = 4.000e-04
height = 3.000e-04

To do the given task we can write the following m file and execute it. The output of the matlab is given below the codes.

% written by Mustafa DEMİR -
%Dec 14, 2013 

mstrpline = rfckt.microstrip('Thickness',5.000e-09,'Width',4.000e-04,'Height',3.000e-04);

analyze(mstrpline,[1e9 2e9 3e9]);

Matlab Command Window Output:

Read More

Tuesday, August 27, 2013

Modeling a Whale Call with Matlab

I did my computer probation in a company called FIGES last year. In one of these days, my job was modeling a whale call of a blue whale. To do this firstly I did a long research, because I have needed
some equations to represent whale call.

According to my research:

Befitting the largest mammal on earth, the call of an adult blue whale is loud and low The
sound carries farther than any other animal sound, and can be detected over a thousand miles
away. The call has a distinct pattern. An a “trill” usually precedes a series of B “moans.”
There is little variation in the call among individual whales.

The B call is simpler and easier to analyze. It consists of a fundamental frequency around 16-
17 hertz and a series of harmonics(multiples) of the fundamental frequency. The amplitude of
the call is modulated to produce a loud moan followed by weaker moan.

• The envelope of the signal is treated as a decaying sine wave of the form A0*e^(-
Bt)*sin(2*pi*fm*t) where the amplitude A0 the decay rate B, and the modulating
frequency fm are all adjustable parameters.

• The signal itself is treated as a sum of harmonics sin(2*pi*n*f0*t) for n=0,1,2,3, ... .
The harmonics are assumed to be present for the entire duration of the call, even
though the higher harmonics appear and disappear in the middle of the call. (Simply
chopping off the higher harmonics introduces unwanted frequencies.)

• Because blue whale calls are so low, they are barely audible to humans. The time scale
in the data being modeled is compressed by a factor of 10 to raise the pitch and make
it more clearly audible. The model works with the same “x10” audible frequencies.

Using these informations I wrote the script in the following:

The Blue Whale B call model is shown in following figure. If you also wanna hear the voice, write down the codes into a matlab mfile and run it..

Read More

Monday, August 19, 2013

Loops in Matlab ( for in matlab, while matlab, for matlab)

There are two loops in matlab:
  • For loops 
  • While loops
For loops are used when the number of loop is certain whereas while loops are used when the condition is specified for a loop to terminate the code in it. 

You can see the usage form of for loops and while loops from given examples below:

Example 1: For loop

Example 2: While loop

For information in detail type in command window:

'help for' to get the following result:

or you can type doc for  to get reference page in help browser. I am not giving it here.

For while loops you can type:

'help while' to get information in detail like as given below:

or you can type 'doc while'  to get reference page in help browser. I am not giving it here.

If you have any question or need some help, leave a comment below.

Read More

Saturday, August 10, 2013

Initial Arrangement Example in Matlab

Read More

A Traveling Wave by Making an Animation in MATLAB

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.

Read More

Friday, July 19, 2013

Modelling a Digital Communication System using Matlab

I modelled the digital communication system by a simple script. In first, if you haven't installed Matlab in your system yet, you can see my article about installation of matlab on Linux.
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. I did this by writing the script in the following. When I run I got the pics showing the script is nicely working in the below of the script..

See the pics below:


Read More

Wednesday, March 27, 2013

Generating Square Wave from Fourier Series by Using MATLAB

Fourier series always suprised me.. Harmonics are amazing.. They added together and we get another function.. Let's see it by our own eyes. How harmonics summation give the square wave?
To do this and see step by step I wrote a small m-file and used pause command to see changes in function when harmonics are added. Here you are the codes in the mfile:

If you haven't installed matlab on your system, you may wanna see my post about how to install matlab on linux.

Copy the code into a new mfile and execute it.. See the square wave generator from fourier series... :)

Read More

Thursday, March 21, 2013

Send Mail Using Matlab

Send mail using Matlab
To send mail via matlab we need to tell to matlab our username,password,server etc. To doing this enter the following codes and modify it, it is just an example.
By the way, if you haven't installed matlab into your system, you may wanna read my older post about installation of matlab on linux.


Read More

Monday, March 18, 2013

Matlab İle Dijital İletişim Sistemi Modeli

Bu yazımda dijital iletişim sistemini modellemek için yazdığım matlab scriptini anlatmak istedim. İlk olarak, sisteminize henüz matlab kurmadıysanız matlab kurulumunu anlattığım yazımı okuyabilirsiniz. Bir dijital telefon ya da analog telefon aldığı analog sinyali yani sesimizi yollamadan önce dijital sinyale çevirir. Analog sinyaller reel değerler alabilirken dijital sinyaller sadece sonlu ve tamsayı değerleri alabilir. Yazdığım scripti açıklamalarıyla birlikte aşağıda görebilirsiniz..

Analog kaynakları ve dijital sinyalleri ayrı ayrı çizdirdim. Aşağıdaki grafiklerden görebilirsiniz.

Dijital Sinyaller(Analoglardan Çevirdiğimiz)

Sesimizi Temsil Eden Analog Kaynaklar

Herhangi bir sorunuz ya da yardıma ihtiyacınız varsa, aşağıya yorum olarak yazabilirsiniz..

Read More