Borrar filtros
Borrar filtros

what is this error: Unexpected MATLAB expression?? andhow can i fix it???

3 visualizaciones (últimos 30 días)
Dear Sir,
I am looking to make radar system by using the chirp generator (to generate chirp signal as sawtooth signal from low to high frequency). I will use the operational amplifier as part of my research work to make amplification to sawtooth signal so I made search in the internet to learn how I can make operational amplifier by the Matlab. After long time, I found something can help me in how i can make inverting amplifier by Matlab circuit where it is nearest to the operational amplifier that I will use in my research work. After I made run to this program by the matlab that I found there is error " Unexpected MATLAB expression". I would like to know "Where is the error in this program to fix it and making changing in some commands in this program to use it in my research work??"
I would like to help me as soon as possible...
-------------------------------------------------------------------------------------
This is the matlab code:
R1=10e3; % resistance, ohms
R2=20e3; % resistance, ohms
R3=20e3; % resistance, ohms
R4=20e3; % resistance, ohms
R5=20e3; % resistance, ohms
% op amp parameter
vsat=15; % saturation voltage,V
% source parameters
M=3; % amplitude, V
f=1000; % frequency, Hz
w=2*pi*f; % frequency, rad/s
theta=(pi/180)*45; % phase angle, rad
tf=2/f; % final time
N=200; % number of increments
t=0:tf/N:tf; % time, s
vs = M*cos(w*t+theta); % input voltage
for k=1:length(vs)
Y=[ 1/R2, 1/R2 + 1/R3 + 1/R4; % nodal admittance matrix
0, -1/R3];
J=[-vs(k)/R1 0 ]; % input current vector
V=J/Y; % node voltage vector
vo(k)=V(2); % record the output voltage
if (vo(k)>vsat) vo(k)=vsat; % check for saturation
elseif (vo(k)<-vsat) vo(k)=-vsat;
end
end
plot(t, vo, t, vs) % plot the transfer characteristic
axis([0 tf -20 20])
xlabel('time, s')
ylabel('vo(t), V')

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 2 de Ag. de 2012
If you run that, what line does the error occur on? You are likely missing a ')', ']' or '}' or similar.
  12 comentarios
Greg Heath
Greg Heath el 4 de Ag. de 2012
I had no prolems when I cut and pasted your code.
What version of MATLAB do you ave?
Mohamed Elwakdy
Mohamed Elwakdy el 4 de Ag. de 2012
Thank you very much, Sean...
I have Matlab Version 2008

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by