Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Plotting a transfer function?

Status
Not open for further replies.

fouadalnoor

Member
Hello guys,

I was just wondering how I would plot the following transfer function in Matlab:

H(jw) = num/denom

num = 1

denom = 1+j((1x10^-12w^2 -1)/1x10^4w)

I just cant seem to get the denom in the 's' form and then be able to use Matlab...

Any help appreciated!
 
Hello Fouad,

If you want to trace the Step Response - Response of your system to a Heaviside Step Function-, you might want to write down your Transfer Function in a simple way..

Example:

Suppose that after you've done your Laplace Transform, your Transfer Function "F" is F = 1 / 3s^2 + 5s + 2

This is what you write into Matlab Command Window, the stuff between /* and */ are my comments, not to be written in the command window of course :) :

Num = 1 /* You're creating a variable named Num, and assigning to it the value 1. The name could've been anything, but for practical reasons, you want them to be easy to figure out. */

Denum=[3 5 2] /* This is an "array" with the coefficients of the Denum polynome. Leave a space between them. */

F=tf(Num, Denum) /* "tf" is a reserved word and stands for Transfer Function. It is case sensitive, but Matlab figures it out, and just signals an error that doesn't affect the resluts. Basically, you're telling Matlab "F is the Transfer Function which numerator is the value stored in the variable Num, and which denuminator is the value stored in the variable Denum, Please create it" And it creates a variable F. Look at your right, a window named "Workspace", all the three variables appear to you, and you can modify them as you please. */

step(F) /* You're asking Matlab to trace the Step Response of F. You could've written impulse(F) and it would've traced the Impulsionnal Response of F.. Both in a beautiful figure that you could save in a jpg, tiff or other formats.

A tip:

When you do one then the other, the second plot replaces the first. If you want to have multiple plots in one window, to compare or something, use "hold". If you want to reset it as it was, use "hold" a second time.

Another tip:

When you write Num=1 and hit "Return".. Matlab confirms it to you and displays Num = 1..

If you don't want to, you can add ";" and write "Num= 1;" and hit "Return", but then again.. Sometimes, you want a confirmation that everything is running smoothly.

Good continuation..
 
Last edited:
Thank you for your help Jugurtha. I could not have finished my homework without you. Here is what my code looks like for 3 different values of K in my system:

clc;
clear all;
close all;
num_a = [5 12.5];
num_b = [10 25];
num_c = [30 75];
dem = [1 3.75 13.125 12.5];
F_a = tf(num_a, dem);
F_b = tf(num_b, dem);
F_c = tf(num_c, dem);
hold all;
step(F_a);
step(F_b);
step(F_c);
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top