Google Answers Logo
View Question
 
Q: C program to calculate impedence ratio over range of frequencies ( No Answer,   0 Comments )
Question  
Subject: C program to calculate impedence ratio over range of frequencies
Category: Computers > Programming
Asked by: noggywoggy-ga
List Price: $15.00
Posted: 06 Feb 2003 10:01 PST
Expires: 06 Feb 2003 16:02 PST
Question ID: 158082
I've got some code written in C I'd like run over to iron out the
bugs, especially from line 161 in particular as I can't get my head
around that bit. Please take a look at my code at
http://www.geocities.com/pnoga/code.txt, I've previously asked
questions on exctly the same topic before but haven't had any success
with answers, hopefully the price for this is acceptable to most
researchers.

A prompt response would be appreciated, i.e. within the next few
hours, and a tip will be offered for especially speedy replies.

Thanks!

Request for Question Clarification by theta-ga on 06 Feb 2003 12:34 PST
Hi noggywoggy-ga,
   It would help if you could specify what problems/unexpected results
you see when you run this code.

   The most obvious error in the line you specified is the
semicolon(;) after the for loop :
     	for(i=0; i<freq_num; i++);
   You would want to remove this semicolon so that the statements in
the block following this loop are executed multiple times. Line 161
becomes :
        for(i=0; i<freq_num; i++)

Also, you have not declared the variables imp1, imp2 and ratio
anywhere, although you use them from line 164 onwards. They seem to be
of the complex type, so add the line ;
   complex imp1,imp2,ratio;
somewhere before line 161.

Also, you refer to imp1's members as imp1.real and imp1.imag, while in
the complex structure definition, you have named the members r and i.
You will have to change that.

Also, the constant PI used on line 128 has not been defined.
Add the line:
#define PI 3.142
after the #include statements in the file.

Another error is in the declaration of the variable omega. You declare
omega on line 76 as a simple double, yet from line 167 onwards, you
use it as an array.
Make up your mind, and declare omega correctly.

Your program did not compile on my VC++ because of the aforementioned
errors. Fix them and your program should start compiling. Then go on
to fixing any logical errors you may find.

Hope this helps.
If the above is what you were looking for, tell me and I will post
this as an answer.

Best of luck with the code! ;-)
(Hope this was fast enough for you)

Regards,
Theta-ga
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy