What does "ac thevenins" mean? If you need a tutorial in complex numbers from the ground up, this probably isn't the place because they're a huge topic. Maybe you could ask a teacher or friend in more advanced math... unless you have more specific questions for us.
The time you enjoy wasting is not wasted time. Bertrand Russell
If you know how to do it mathematically (by hand), I'm sure it's not too hard to translate that into VB code?
For example, to convert a complex number in the form of z = x + jy to polar coordinates, you first need to find the length of the vector:
r = sqrt( x2 + y2 )
Then you need to find the angle:
tanθ = b/a --> θ = arctan(b/a)
The polar form is now:
z = r * ejθ = r ( cosθ + j sinθ )
These are all functions present in VB (probably Math.Arctan for example).
With numbers:
Convert z = 4 + 3i to polar form:
z = sqrt( 42 + 32 ) exp( j * arctan(3/4) )
Not that hard, right? Is this what you want to do?
EDIT
By "AC Thevenins" the topicstarter probably means using Thevenins theorem to model the input/output characteristics of any linear electrical network (with an AC source) to merely one source and one resistor.
Last edited by NickThissen; May 23rd, 2008 at 12:30 PM.
basically what should happen is the user enters 3 values (z1 z2 z3) and v and my program should work out the thevenins voltage and the thevenins impedance and then showing the answer in rectanguar form aswell as polar form
Could you just use InputBox and MsgBox for input and output? The rest you should be able to do based on Nick's example (though he wrote it in .NET instead of in VB6).
The time you enjoy wasting is not wasted time. Bertrand Russell
You'd have to use Atn() instead of Math.Arctan, Str() instead of the .ToString method, and Sqr() [no t] instead of Math.Sqrt. Also, you should probably note that the tangent function isn't truly invertible--for example, -1-i and +1+i have different angles, but Atn(-1/-1)=Atn(1/1) = pi/4. You should account for this with appropriate if checks, if it matters in your case.
The time you enjoy wasting is not wasted time. Bertrand Russell
nick what am getting confused at is what do i state z0 = as the number will change from time to time so do i state z0 = x or something along those lines ?
In my code I am just assigning some random imaginery number to z. How you want to do it in your code depends completely on how the user inputs the number. For example you could use two inputboxes:
Code:
z(0) = Dbl( InputBox("Enter the real part:") )
z(1) = Dbl( InputBox("Enter the imaginery part:") )
(I believe 'Dbl' is used to convert to double, right?)
(You could also use just one inputbox and store it to a string, then use string functions to retrieve the real and imaginery parts)
If you could just explain to us exactly what you want to do instead of let us guess you might get better help!
You are only telling us glimpses of what you need... You need some way to convert a cartesian complex number to a complex number in polar coordinates. I have gave you the exact code for that. How and why does the user need this program? How is the user going to input the number in the first place, how are you going to use the convert number afterwards, etc... etc..?
i have attached the forms of what i have done so far on the 26th may
the user will enter 3 values as shown on my ac form and then click calculate the program should then work out the thevenins resistance and thevenisn voltage in both polar and in rectangular form
i have doen the dc version so if you look at that its simiar to that the answer should be displayed on screen
I'm sorry I dont have VB6 installed here so I can't check out your forms.
If you have the DC version you should also be able to work out the AC version... Have you managed to get the AC version in 'rectangular' form? If so, you can easily use the code I gave you to convert it to polar form...
I did look at the code, but I still don't really know what you want.... However from the code you've got, you really really should have enough information to do this. Sorry, but I'm not coding it for you. If you have a line of code that gives an error, I'm sure people would be happy to explain it and help fix it, but you haven't given us that.
The time you enjoy wasting is not wasted time. Bertrand Russell