Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Missing Matlab operator problem

Status
Not open for further replies.

Antonio_Magma

Full Member level 2
Joined
Jun 21, 2005
Messages
136
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Activity points
2,777
missing matlab operator

New to matlab, currently learning matlab 7

Why is it whenever i try run a code either by typing 'run abc.m' or running from the M-file editor 'Debug -> Run' i always get an error message 'Missing Matlab operator'?

Instead, if i copy the code from the M-file editor, paste it in the Matlab Command window and enter, it runs..what's the problem?
 

missing matlab operator.

Can you show us your code?

Try 'abc' or 'run abc' instead of 'run abc.m'
 

error: missing matlab operator.

It's just a simple tutorial from mathworks.com's own communication toolbox tutorial:

%%Setup
%Define parameters
M=16; %Size of constellation. Since 16QAM
k=log2(M); %Number of bits per symbol, k=4 bits
n=3e4; %Number of bits to process, 30000
nsamp=1; %Oversampling rate. Oversampling is the process of sampling a signal with sampling frequency higher than nyquist frequency

%%Signal source
%Create a binary data stream as a column vector
x=randint(n,1); %Random binary data stream, n x 1 matrix (30000 x 1)

%Plot first 40 bits in a stem plot .A stem plot displays data as lines
%(stems) terminated with a marker symbol at each data value.
stem(x(1:40),'filled');
title('Random Bits');
xlabel('Bit index');
ylabel('Binary value');

%--------------------------------------------------------------------------
%%Bit-to-symbol mapping
%Convert bits in x into k-bit symbols
xsym=bi2de(reshape(x,k,length(x)/k).','left-msb');

%%Stem plot of symbols
%Plot first 10 symbols in a stem plot
figure; %Create new figure window
stem(xsym(1:10));
title('Random Symbols');
xlabel('Symbol index');
ylabel('Integer value');

%--------------------------------------------------------------------------
%%Modulation
%Modulate using 16-QAM
y=qammod(xsym,M); %M already defined above as 16

%Transmitted signal
ytx=y;

%%Channel
%Send signal over an AWGN channel
EbNo=10; %in dB
snr=EbNo+10*log10(k)- 10*log10(nsamp);
ynoisy=awgn(ytx,snr,'measured');

%%Recieved signal
yrx=ynoisy;

%%Scatter plot
%Create the scatter plot of noisy signal and transmitted signal on the same
%axes.
h=scatterplot(yrx(1:nsamp*5e3),nsamp,0,'g.');
hold on;
scatterplot(ytx(1:5e3),1,0,'k*',h);
title('Recieved signal');
legend('Recieved signal','Signal constellation');
axis([-5 5 -5 5]); %Set axis ranges
hold off;

%%Demodulation
%Demodulate signal using 16QAM
zsym=qamdemod(yrx,M);

%%Symbol-to-bit mapping
%Undo the bit-to-symbol mapping performed earlier
z=de2bi(zsym,'left-msb'); %Convert integer to bits
%Convert z from a matrix to a vector
z=reshape(z.',prod(size(z)),1); %.' = array transpose

%%BER computation
%Compare x and z to obtain the number of errors and the bit error rate
[number_of_errors,bit_error_rate]=biterr(x,z)

I don't think there is anything wrong with the code since when i paste the code into the command window, it runs. But strange is that i can't run from the M-file editor or by typing run abc.m or abc.m or abc etc....this shouldn't be right?

My friend running the same code doesn't seem to have any problem running from the editor or just by typing the .m filename.

It's nothing serious actually, since i still can run codes...its just...well...strange....
 

error: missing matlab operator

That code runs fine here with all three methods. I have version 7.0.1 SP1, running on Win2k SP3.
Maybe your MATLAB installation is broken. Uninstall and try again?
 

missing matlab operator help

Well, i've done that, reinstall...but still the same...
 

matlab and operator

Hi,

You can ask for the problem in www.mathworks.com with the program code and the error message. So that we can learn whether it is a bug or not. Sometimes matlab gives suspicious (even mystic) errors or warnings. For example after running a simulink model when you look at the matlab window you can see lots of warnings many of which you can not understand.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top