Lost Password?


Go Back   CodeCall Programming Forum > Software Development > General Programming

General Programming Non language specific, Assembly, Linux/Unix, Mac and anything not covered in other topics. Talk about Programming Theory here.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-17-2008, 08:27 AM
Reza Reza is offline
Newbie
 
Join Date: Feb 2008
Posts: 2
Rep Power: 0
Reza is on a distinguished road
Default can someone help with this function in matlab?

i've wrote this m-file but it has some errors.
Code:
function dpzplot(b,a) 
% dpzplot(b,a) 
% Plots the pole-zero diagram for the discrete-time system function 
% H(z)=b(z)/a(z) defined by numerator and denominator polynomials b and a. 
la=length(a); 
lb=length(b); 
if (la>lb), 
b= [b zeros(1,la-lb)] ; 
elseif (lb>la), 
a= [a zeros(1,lb-la)] ; 
end 
ps = roots(a) ; 
zs = roots(b) ; 
mx = max(abs([ps' zs' .95]))+0.05; 
clf 
axis ([-mx mx -mx mx]); 
axis('equal'); 
hold on 
w=[0:0.01:2*pi]; 
plot(cos(w),sin(w),'.'); 
plot([-mx mx],[0 0]); 
plot([0 0],[-mx mx]); 
text(0.1,1.1,'Im','sc'); 
text(l.l,0.1,'Re','sc'); 
plot(real(ps),imag(ps),'x'); 
plot(real(zs),imag(zs),'o'); 
numz=sum(abs(zs)==0); 
nump=sum(abs(ps)==0); 
if numz>l, 
text(-0.1,-0.1,num2str(numz)); 
elseif nump>l, 
text(-0.1,-0.1,num2str(nump)); 
end 
hold off ;



error:when running m-file:

??? Input argument "a" is undefined.

Error in ==> dpzplot at 5
la=length(a);

what should i do?

Last edited by v0id; 02-17-2008 at 09:43 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 02-17-2008, 09:44 AM
v0id's Avatar   
v0id v0id is offline
Retired
 
Join Date: Apr 2007
Location: Denmark
Posts: 2,635
Last Blog:
CherryPy(thon)
Rep Power: 28
v0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of lightv0id is a glorious beacon of light
Send a message via MSN to v0id
Default

Remember to use code-tags!
__________________
05-03-2007 - 11-13-2008
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-18-2008, 05:14 AM
Reza Reza is offline
Newbie
 
Join Date: Feb 2008
Posts: 2
Rep Power: 0
Reza is on a distinguished road
Default

Quote:
Originally Posted by v0id View Post
Remember to use code-tags!
tanx for answer,i forgot to say i'm a beginner and tanx for code-tag u add.

but what should be changed that i could run the program

Last edited by Reza; 02-18-2008 at 05:16 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SecurityAudit vinay Visual Basic Programming 27 01-07-2008 01:14 PM
multi-pass preprocessing kenna C and C++ 11 08-14-2007 11:45 AM
Reg Fucntion pointers sowmi C and C++ 9 07-29-2007 04:29 AM
small help in this generator function plz SamehSpiky C and C++ 3 06-22-2007 12:47 PM


All times are GMT -5. The time now is 06:01 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 98%

Ads