Error: Unexpected MATLAB expression. SYNTAX ERROR?!

>> f=10:1:100000; % f is the frequency varying from 10 to 100000 in steps of 1hz
>> G=2483.71*(2pi*f*10)(2pi*f*100)*1018/(60.7*2pi*f*100)*10-9+1)(6.07*2pi*f*10*10-9+1);
>> faxis=0.000001*f;
>> plot(f axis,f,'w',f,G,'r')
xlabel('Frequency, rad/s'), ylabel('Gain, V/V')
title('Frequency Response Plots')
subplot(2,1,2), semilogx(w, phase)
xlabel('Frequency, rad/s'), ylabel('Phase, deg')
>> xlabel ('Frequency in Hz')
>> ylabel ('Voltage in volts')
>> text (6,6,'G(f)')
G=2483.71*(2pi*f*10)(2pi*f*100)*1018/(60.7*2pi*f*100)*10-9+1)(6.07*2pi*f*10*10-9+1);
|
Error: Unexpected MATLAB expression.
Hey everyone, how are you? I have this code that WAS working not too long ago but when I come to simulate it, it doesn't wanna work and it spits out this error message. This is for a Bode plot Midband voltage amplifier circuit. I have checked my work and everything and it was working before but I don't see what I changed in it. Anyone have any ideas? Thank you :)

 Réponse acceptée

Marta Salas
Marta Salas le 18 Juin 2014

1 vote

You need to checked carefully what you have written in the definition of G, I have spotted some * missing, there is also a missing bracket (bold one) that I can not figure out where it starts:
G=2483.71*(2 * pi*f*10) * (2 * pi*f*100)*1018/(60.7*2 * pi*f*100)*10-9+1 ) *(6.07*2*pi*f*10*10-9+1);

Plus de réponses (2)

Image Analyst
Image Analyst le 18 Juin 2014

1 vote

Why doesn't the G= have a >> in front of it? Is it on the same line as the call to text()? Anyway, that line has for ( but 5 ) so there is a mismatch in the number pf parentheses. Fix that.

9 commentaires

Also, there is a missing operation in between ) and ( in
.....-9+1)(6.07*.......
You can't have two parentheses back to back like that.
Sha Ka
Sha Ka le 18 Juin 2014
Alrighty, I did some editing and I saw that I had a few mistakes and I am still coming across the same problem:
>> f=10:1:100000; % f is the frequency varying from 10 to 100000 in steps of 1hz >> G=2483.71*(2pi*f*10)*((2pi*f*100)*(10^18))/((60.7*2pi*f*100)*(10^-9))+1)*((6.07*2pi*f*10*(10-9))+1); G=2483.71*(2pi*f*10)*((2pi*f*100)*(10^18))/((60.7*2pi*f*100)*(10^-9))+1)*((6.07*2pi*f*10*(10-9))+1); | Error: Unexpected MATLAB expression.
>>
Marta Salas
Marta Salas le 18 Juin 2014
write 2pi as 2*pi
Sha Ka
Sha Ka le 18 Juin 2014
>> G=2483.71*(2*pi*f*10)*((2*pi*f*100)*(10^18))/((60.7*2*pi*f*100)*(10^-9))+1)*((6.07*2*pi*f*10*(10-9))+1); G=2483.71*(2*pi*f*10)*((2*pi*f*100)*(10^18))/((60.7*2*pi*f*100)*(10^-9))+1)*((6.07*2*pi*f*10*(10-9))+1); | Error: Unbalanced or unexpected parenthesis or bracket.
>>
I got the same result :/
Marta Salas
Marta Salas le 18 Juin 2014
Modifié(e) : Marta Salas le 18 Juin 2014
You still have a mismatch in in the number of parenthesis. The symbol "|" indicates which braket is unbalanced
Sha Ka
Sha Ka le 18 Juin 2014
Alrighty, I got that error fixed, now I'm getting this:
>> f=10:1:100000; % f is the frequency varying from 10 to 100000 in steps of 1hz G=2483.71*(2*pi*f*10)*((2*pi*f*100)*(10^18))/(((60.7*2*pi*f*100)*(10^-9))+1)*(((6.07*2*pi*f*10)*(10^-9))+1); Error using * Inner matrix dimensions must agree.
What does that mean?
Marta Salas
Marta Salas le 18 Juin 2014
Maybe you want to use element-wise multiplication: http://www.mathworks.com/help/matlab/ref/times.html
Sha Ka
Sha Ka le 18 Juin 2014
HEY it worked!!! Perfect! Wow thank you so much for all of your help! I appreciate it very much :D
You're welcome. You can "thank" us by voting for our Answers.

Connectez-vous pour commenter.

Pallavi
Pallavi le 18 Juin 2014

1 vote

G=2483.71*(2pi*f*10)(2pi*f*100)*1018/(60.7*2pi*f*100)*10-9+1)(6.07*2pi*f*10*10-9+1);
Please check this expression which says missing parenthesis.
(60.7*2pi*f*100)*10-9+1) is the problem area with no left parenthesis.

Catégories

En savoir plus sur Circuit Envelope Simulation dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by