查看: 2310|回复: 2|关注: 0

[已解决] 关于未定义函数或变量的问题

[复制链接]

新手

5 麦片

财富积分


050


3

主题

6

帖子

0

最佳答案
发表于 2017-11-30 10:11:07 | 显示全部楼层 |阅读模式
我的代码中全程没有用到demonstration,但是文件名里面有demonstration,为什么会出现错误说:关于未定义函数或变量 demonstration,谢谢大佬解答。
clear;
clc;
%---------Input Fields------------------------
N=10000000; %Number of input bits
EbN0dB = -6:2:10; % Eb/N0 range in dB for simulation
%---------------------------------------------
data=randn(1,N)>=0; %Generating a uniformly distributed random 1s and 0s
bpskModulated = 2*data-1; %Mapping 0->-1 and 1->1
M=2; %Number of Constellation points M=2^k for BPSK k=1
Rm=log2(M); %Rm=log2(M) for BPSK M=2
Rc=1; %Rc = code rate for a coded system. Since no coding is used Rc=1
BER = zeros(1,length(EbN0dB)); %Place holder for BER values for each Eb/N0
index=1;
for k=EbN0dB,
    %-------------------------------------------
%Channel Noise for various Eb/N0
%-------------------------------------------
%Adding noise with variance according to the required Eb/N0
EbN0 = 10.^(k/10); %Converting Eb/N0 dB value to linear scale
noiseSigma = sqrt(1./(2*Rm*Rc*EbN0)); %Standard deviation for AWGN Noise
noise = noiseSigma*randn(1,length(bpskModulated));
received = bpskModulated + noise;
%-------------------------------------------
%Threshold Detector
estimatedBits=(received>=0);
%------------------------------------------
%Bit Error rate Calculation
BER(index) = sum(xor(data,estimatedBits))/length(data);
index=index+1;
end
%Plot commands follows
plotHandle=plot(EbN0dB,log10(BER),'r--');
set(plotHandle,'LineWidth',1.5);
title('SNR per bit (Eb/N0) Vs BER Curve for BPSK Modulation Scheme');
xlabel('SNR per bit (Eb/N0) in dB');
ylabel('Bit Error Rate (BER) in dB');
grid on;
hold on;
theoreticalBER = 0.5*erfc(sqrt(10.^(EbN0dB/10)));
plotHandle=plot(EbN0dB,log10(theoreticalBER),'k*');
set(plotHandle,'LineWidth',1.5);
legend('Simulated','Theoretical');
grid on;

新手

5 麦片

财富积分


050


3

主题

6

帖子

0

最佳答案
 楼主| 发表于 2017-11-30 10:52:19 | 显示全部楼层
已解决.....因为文件名中带了空格....

新手

5 麦片

财富积分


050


1

主题

9

帖子

0

最佳答案
发表于 2018-2-11 12:09:22 | 显示全部楼层
function pushbutton5_Callback(hObject, eventdata, handles)
conna=database('DataSourceName','','');
curs=exec(conna,'select * from[建筑物信息管理表]');
curs=fetch(curs);
data=curs.Data;
close(curs)
close(conna)
set(handles.uitable1,'value',1);
set(handles.uitable1,'string',data);
请问楼主我一直报错说:未定义与 'struct' 类型的输入参数相对应的函数 'fetch'是怎么回事呢?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐上一条 /3 下一条

快速回复 返回顶部 返回列表