matlab 智能卡pr3,难道是matlab的bug

这部分的所有代码,在matlab中运行没有问题:

94bec4e1c34eb595d0061b5fdd2f883f.png

20090519224437390.jpg (20.44 KB, 下载次数: 2)

2009-5-20 22:45 上传

但是pr3和pr4的计算结果一样,不对呀:

54846cd38a8d9b9df416b84bc6b66fba.png

20090519224346390.jpg (38.04 KB, 下载次数: 0)

2009-5-20 22:45 上传

syms theta a b h w c;

a=100;

b=0.4;

theta=2.5;

c=1;

h=0.16:0.02:0.34;

w=(theta-b).*c./(theta-1);

s= h-(h.*w ./((theta-1).*(w-c)+w.*b));

s(s<0)=0;

sp=((a*b) ./((h-s).*theta)).^(1 ./(1-b)).*((theta-1) ./(theta.*w)).^((theta-1) ./(1-b));

[sp]

p=w.*theta ./(theta-1);

[p]

d=a*sp.^b.*p.^(-theta);

[d]

pr1=(w-c).*a.*sp.^b.*p.^(-theta);

[pr1]

pr2=(p-w).*a.*sp.^b.*p.^(-theta)-h.*sp;

[pr2]

prt1=pr1+pr2;

[prt1]

wr=(c./(theta-1)+theta.*c)./(theta-1);

[wr]

s2=h.*theta./((1+b).*theta-1);

s2(s2<0)=0;

[s2]

sr=((a.*b)./(s2.*theta)).^(1./(1-b)).*((theta-1)./((c+c./(theta-1)).*theta)).^((theta-

1)./(1-b));

[sr]

p2=theta.^2.*c./((theta-1).^2);

dr=a*sr.^b.*p2.^(-theta);

pr3=(wr-c)*a.*sr.^b.*p2.^(-theta)-s2.*sr;

[pr3]

pr4=c./(theta-1)*a.*sr.^b.*p2.^(-theta)-(h-s2).*sr;

[pr2]

prt2=pr3+pr4;

[prt2]

sp2=((a*b) ./(h.*theta)).^(1 ./(1-b)).*((theta-1) ./(theta*c)).^((theta-1) ./(1-b));

[sp2]

p3=c.*theta./(theta-1);

[p3]

prc=(p3-c)*a.*sp2.^b.*p3.^(-theta)-h.*sp2;

[prc]

[本帖最后由 laurence06 于 2009-5-20 22:45 编辑]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个GPS定位原理的matlab程序示例: ``` % 清除变量和屏幕 clear all; clc; % 常数定义 c = 299792458; % 光速 f1 = 1575.42e6; % L1频率 f2 = 1227.6e6; % L2频率 lambda1 = c / f1; % L1波长 lambda2 = c / f2; % L2波长 % 接收机坐标 rec_pos = [0; 0; 0]; % 卫星坐标 sat_pos = [ -1918399.7195, -5129488.0524, 3327023.3137; 13163232.6591, -23736512.5898, 13363132.8845; 2228513.7271, 45991678.6888, 4334166.8315; -2489571.2058, 21819482.3973, 19076735.1519; 20320183.5789, 10707713.9264, 21624357.3206; 17801131.2412, -18685121.3314, 19100896.9823]; % 接收机时钟误差 t_rec = 1e-6; % 卫星时钟误差 t_sat = [ -2.265e-5; -2.268e-5; -2.277e-5; -2.272e-5; -2.270e-5; -2.273e-5]; % 接收机时间 t = 0; % 伪距测量值 pr1 = norm(rec_pos - sat_pos(:, 1)) + c * (t_rec - t_sat(1)); pr2 = norm(rec_pos - sat_pos(:, 2)) + c * (t_rec - t_sat(2)); pr3 = norm(rec_pos - sat_pos(:, 3)) + c * (t_rec - t_sat(3)); pr4 = norm(rec_pos - sat_pos(:, 4)) + c * (t_rec - t_sat(4)); pr5 = norm(rec_pos - sat_pos(:, 5)) + c * (t_rec - t_sat(5)); pr6 = norm(rec_pos - sat_pos(:, 6)) + c * (t_rec - t_sat(6)); % 接收机位置估计 x0 = [0; 0; 0]; % 非线性最小二乘解算 x = lsqnonlin(@(x) [ norm(x - sat_pos(:, 1)) + c * (t - t_rec - t_sat(1)) - pr1; norm(x - sat_pos(:, 2)) + c * (t - t_rec - t_sat(2)) - pr2; norm(x - sat_pos(:, 3)) + c * (t - t_rec - t_sat(3)) - pr3; norm(x - sat_pos(:, 4)) + c * (t - t_rec - t_sat(4)) - pr4; norm(x - sat_pos(:, 5)) + c * (t - t_rec - t_sat(5)) - pr5; norm(x - sat_pos(:, 6)) + c * (t - t_rec - t_sat(6)) - pr6], x0); % 显示结果 disp('接收机位置估计:'); disp(x); ``` 这个程序演示了如何使用非线性最小二乘法来实现GPS定位原理。输入的数据包括接收机和卫星的坐标、时钟误差和伪距测量值,程序输出接收机的位置估计。你需要根据你自己的数据进行相应的修改。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值