I am trying to generate Matlab code into C code to use for TMS320C6713 Processor
Show older comments
Hello,
I am trying to generate Matlab code into C code to use for TMS320C6713 Processor. But, I am getting errors "unknown compiler".
Here is my Matlab code. Please check it and give me your suggestions. Thanks in advance.
function thm = Testing(Vin,Vout) %function hh = xlabel(varargin) %#codegen SampleTime = 0.001; R1=6.8; Vin = [2.2 3 4.2 3.5 3.6]; Vout = [1 2 3.2 2.5 3.2]; Ts=SampleTime; Fs=1/Ts; t=Ts* (0:1:length(Vin)-1); U=Vout; % U = Voltage across the coil Y=(Vin-Vout)/R1; % Y = Coil current % RECURSIVE ESTIMATION using RLS Algorithm %Assume a0 = L/(L+R*Ts), b0 = 1/(L+R*Ts) sig=500; ff=1; npara=2; p=zeros(npara,npara); for i=1:npara p(i,i)=sig; end thm = [ ]; % thm = estimated parameters after each iteration th=[0;0]; % th = current parameter estimates (initially zeros) N=length (Y); for n=2:N, phi=[Y(n-1);Ts*U(n)]; % phi is the regression vector gain=ff+phi'*p*phi; e=Y(n)-phi'*th; % e = prediction error th=th+(p*phi* e / gain); p=(p-(p*(phi*phi')*p/gain))/ff; thm =[thm;th']; % store estimated value of th end
coder.extrinsic('figure'); figure(1); coder.extrinsic('plot'); plot(t,U,'g',t,Y,'b'); %title ('Input voltage (green) and output current (blue) '); figure(2) %coder.extrinsic('plot'); plot(thm) %title('Convergence of paramter estimates for d.t. model' ); coder.extrinsic('xlabel'); coder.extrinsic('ylabel'); xlabel('Iteration number'); ylabel ('Parameter estimates'); a0hat=thm(N-1,1); %a1hat = final estimate of a0 b0hat=thm(N-1,2); %b0hat = final estimate of b0 coder.extrinsic('disp'); disp('Estimatio using d.t. model and RLS algorithm' ) Lhat = a0hat/b0hat; Rhat=((1/b0hat)-Lhat)/Ts; %y = u;
2 Comments
Kaustubha Govind
on 16 Oct 2012
Also, please paste the exact "codegen" (or emlc) command that you are using and the exact error message. Have you already run "mex -setup" and selected a MEX compiler?
Answers (0)
Categories
Find more on Code Generation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!