필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
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')

채택된 답변

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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by