Prev: interp1q faster alternative
Next: Problems about using the fourier() and ifourier() to get the variables convolution
From: Monah on 16 Jun 2010 04:36 Hi, I am new to simulink and embedded matlab function, I am trying to create a block which I will connect it to another block, so I should have an output of it... the first version of my block is like that: function y=questionI1(vals) %#eml eml.extrinsic('bit_gen'); eml.extrinsic('view_data'); eml.extrinsic('stem'); eml.extrinsic('AXIS'); eml.extrinsic('title'); eml.extrinsic('sgnl_prm_gen'); eml.extrinsic('bit2int'); eml.extrinsic('int2symb'); eml.extrinsic('pam_encoding'); eml.extrinsic('plot'); eml.extrinsic('figure'); eml.extrinsic('rec_filt_dsmp'); eml.extrinsic('eye_diag'); eml.extrinsic('hold on'); eml.extrinsic('ML_decision'); eml.extrinsic('int2bit'); %Assigning of entry values p0=vals(1,1); A=vals(1,2); sf_b=vals(1,3); nbits=vals(1,4); M=vals(1,5); %Generate random bits bit_vec = bit_gen(nbits,p0); %Display 5 element binary sequence % view_data(bit_vec,100,5,'samp',vals(1,3),'Binary sequence'); % plot([100:104],bit_vec(1,[100:104])); % bit_vec=bit_vec(1,100:104); figure(1); stem(bit_vec); AXIS ([99.5 104.5 0 1.2]); title('Binary sequence'); % Generate a modulated signal vector [ak,h,sf] = sgnl_prm_gen('ASK',M,'NRZ',sf_b); int_vec = bit2int(bit_vec,M); symb_vec=int2symb(int_vec,ak); pam_vec = pam_encoding(symb_vec,A,h,sf); % Display 5 element NRZ coded sequence % view_data(pam_vec,100,5,'symb',sf,'NRZ coded sequence'); figure(2); plot(pam_vec); AXIS ([99.5 104.5 -1.2 1.2]); title('NRZ coded sequence'); % % % Filter and down-sample [rec_vec,filter_out]=rec_filt_dsmp(pam_vec,fliplr(h),sf); % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Display eye diagram % figure(3) % plot(filter_out); % AXIS ([89 120 -4 4]); % title('NZR code eye diagram'); % eye_diag(filter_out,100,3,sf,100,'NZR code eye diagram'); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %Take a decision rint_vec = ML_decision(rec_vec,A,h,fliplr(h),ak); rbit_vec = int2bit(rint_vec,M); figure(4) stem(rbit_vec,'filled'); AXIS ([99.5 104.5 0 1.2]); title('Retrieved binary sequence'); % view_data(rbit_vec,100,5,'samp',sf,'Retrieved binary sequence'); y=bit_vec; I really need to have this bit_vec that I create on output, but everytime i run it a problem occurs saying Function output 'y' cannot be of MATLAB type. could anyone have experienced this problem before?? I really need to get this bit_vec on output. thank you. Monah |