Yeah M4 is obviously wrong; did you even check bias current, it must be some amperes!
Simulations can be tricky to get into. You need to be careful to mind the intended limits of your circuit, including what seem like fairly obvious things, like biasing.
A real circuit will smoke and burn if you wire it wrong. SPICE happily continues on its way, feeding you -- not bullshit numbers, but simply what the model says it would be -- it's a computer, not a circuit, it doesn't know anything about real circuits beyond what you've put into the model. GIGO.
Check a good selection of things to be reasonably sure it's doing what you expect it to. Ever had a real op-amp generate 10kV? Or a battery generate 10kA? Probably not! But certain sim models gladly will. This isn't even ludicrous, necessarily: it's just that you need to use models appropriate for the purpose. Such models (3-terminal "general" or "linear" op-amps, or reasonably ideal voltage sources), are useful in certain contexts -- they're very simple and can be used to quickly capture a certain idealization of a circuit being modeled -- but can't be used to represent the totality of behavior of a real device!
It's a learning curve, and this here is a good example of the differences between real and virtual worlds.
M4 is wrong way around, swap source and drain.
Diodes wont bias on a mosfets you need about 3-4 volts to bias on a mosfet.
Probably best done with a Vbe multiplier.
If i swap source and drain the circuit doesn't work. I attached the file ,if you use LTspice you can try it.
It won't work
without other changes because the bias voltage isn't enough!
Stack up more diodes, or better yet use a Vbe multiplier, as indicated.
Vbe mult. is effectively an adjustable diode: take a BJT, emitter as cathode, collector as anode, resistor divider from C to B to E.
You will need to adjust the Vbe ratio in practice because Vgs(th) has a wide manufacturing spread (+/- a volt or so). In the sim, just trim one resistor until bias current looks right. In practice, use a trimmer resistor for the bottom one.
The other glaring problem here: the low impedance source. Of course it shows near unit gain and low phase shift -- the 0.1 ohm source is able to brute-force its way through all that capacitance. You aren't amplifying anything, but you will indeed get a low output impedance from this. Not lower than the source, mind; or, more specifically, not with any current gain.
Normally we model RF circuits out of 50 ohms, as that's convenient for transmission lines (50 ohms into BNC, SMA, etc.) and test equipment (most general electronics lab equipment is 50 ohms; video stuff, mostly 75).
So, the source should have 50 ohms in series, and the load might also want to be tested with 50 ohms, or maybe with a range of impedances.
It might also be worth checking it in reverse, i.e. see how much power reflects off the output, or couples back to the input (isolation).
In general, we can model an amplifier as a two-port, a matrix of 4 coefficients (input reflectance; forward gain; output reflectance; reverse gain or isolation). These correspond to input and output resistance and impedance, and gain and feedback, but generalize it so that we don't need to construct an equivalent circuit, just measure the values and do a little matrix math to work with any system we need.
That said, we can make some observations:
- IRF510 is essentially dead weight at 100MHz.
This might not be well modeled, actually. Most MOSFETs have a diffusion characteristic, which is to say, as the gate voltage spreads out over the die (say from a step change in terminal voltage), it kind of "soaks" into the structure, going through distributed resistances and capacitances until it finally covers all corners of the die.
Older designs like IRF510 have a pronounced diffusion characteristic, meaning gain goes as ~1/sqrt(F) above cutoff.
This also means, not just the gate circuit, but the drain circuit as well (and the relatively significant overlap between both!), tends to be rather lossy. So, not only is the gain dropping, but you're losing a lot of signal in the chip itself, in the process.
They can still be effective in the SW band (up to low 10s MHz), but by there, capacitance is so dominant, and gain dropping off noticeably, that it's not economical to push higher.
It might still have gain at 100MHz, say, but it's not that you want to actually use it up there: the impedance will be so low, the gain tiny (<10dB), available maximum power small (<10% of bias?), and the package strays (lead inductance) almost impossible to deal with (it might be impossible to keep from oscillating!).
Proper RF transistors have compact designs with low-resistance connections, so the gate voltage goes from terminal to active MOS elements with little loss or excess capacitance. In particular, Cgd is lower, which further helps with isolation factor and stability.
Newer power transistors tend to have a more RC (single pole) dominant sort of response, I think usually a matter of fractal connections (i.e. a wide interconnect spans the width of the die, then branches into many thinner interconnects, that branch further into myriad strips of actual active MOS cells). They're still unsuitable for RF purposes (capacitance is highly nonlinear, and still dominant so that signal bandwidth is only some 10s MHz), but this all contributes to somewhat higher bandwidth as an RF amp, and improved efficiency at lower frequencies (particularly the switching application they're designed for).
So, among common parts (and especially among anything that can reasonably be described as "complementary"*), there really aren't a lot of things you can use here, anyway; something like 2N7002/BSS84 is too small (low power dissipation), and already too high capacitance (drops off in the 10s MHz again).
*BJTs are much more complementary than MOSFETs, incidentally. MOSFETs are directly limited by electron/hole mobility, which is about 2.5 times worse for P-channel in silicon. Normally, the P-ch complement is made twice the size of the N-ch, so its capacitance is double the N-ch's, and Rds(on) only a little higher, giving an acceptable compromise. So, this is especially annoying for RF purposes where we'd love to have complementary parts, but it just can't happen.
RF MOSFETs comparable to jellybean BJTs are long since obsolete, and what counts as "RF" these days is up in the GHz (and you won't ever find P-ch among them). Even RF BJTs are getting rarer and rarer; the old standby 2N3866/2N5160, despite the antique metal can and boutique pricing, are still surprisingly promising for this sort of application. MMBTH10 and 81 are still, mmmh, mildly available I guess, but also quite low power. BFT92 are now obsolete.
- Strays can be modeled, at least roughly, by building a circuit, then estimating the node capacitances and stray inductances of it. Figure every mm of wire is about a nH.
Note that even minimal lead length TO-220 incurs about 5nH to begin with! SMT can be better (stray inductance rank: TO-247 > TO-220 > D2PAK > DPAK > DFN) but you'll still be screwed on the capacitance of that part.
- Input isn't 50 ohm matched, making this useless for practical purposes.
To be more specific, if its impedance were unmatched, but
very high, that would also be okay, it can then be used as a probe -- see JFET probes for example. But IRF510 will most definitely have too low an impedance. And it's not even that it can be resonated out, due to the high losses mentioned above.
Tim