matlab 改怎么学,初学者求助以下程序运行总是出错 不知道该怎么改

clc;

clear all;

close all;

p=[133.94 66.95 25.73 58.92 9.61 6.60 295.09 13.33 27.11 65.73 1.52 21.71;

133.77 66.42 25.42 58.83 9.55 6.60 295.31 11.31 27.11 65.73 1.52 21.71;

134.64 66.76 25.43 58.90 9.63 6.48 295.36 11.38 27.11 65.73 1.52 21.71;

134.52 66.31 25.44 58.89 9.63 6.65 295.67 11.37 27.11 65.73 1.52 21.71;

135.08 67.45 25.44 58.94 9.64 6.42 295.79 11.38 27.11 65.73 1.52 21.71;

134.64 67.02 25.45 58.93 9.60 6.49 296.03 9.42 27.11 65.73 1.52 21.71;

164.26 80.11 29.25 61.84 10.29 5.54 305.71 -2.07 27.11 65.73 1.52 21.71;

165.51 79.11 33.44 61.79 10.16 5.45 306.00 5.84 27.11 65.73 1.52 21.71;

165.02 81.75 34.85 62.27 10.14 5.47 306.15 8.17 27.11 65.73 1.52 21.71;

164.87 79.89 34.89 61.97 10.23 5.62 306.30 8.15 27.11 65.73 1.52 21.71;

164.51 79.49 34.88 61.79 10.30 5.71 306.29 8.15 27.11 65.73 1.52 21.71;

165.42 80.78 34.91 62.09 10.06 5.54 302.27 8.15 27.11 65.73 1.52 21.71;

165.27 77.43 34.90 61.46 10.01 5.51 302.76 8.15 27.11 65.73 1.52 21.71;

201.17 96.43 36.69 67.39 10.80 5.29 318.01 -13.76 27.11 65.73 1.52 21.71;

198.63 94.18 36.70 67.01 10.68 5.55 318.51 -13.79 27.11 65.73 1.52 21.71;

199.00 95.68 36.71 67.08 10.66 5.57 318.82 -12.09 27.11 65.73 1.52 21.71;

200.93 96.56 36.70 67.25 10.61 5.44 319.05 -10.96 27.11 65.73 1.52 21.71;

197.60 95.72 38.07 66.98 10.41 5.77 319.08 -10.98 27.11 65.73 1.52 21.71;

199.29 96.30 38.10 67.11 10.22 5.37 318.83 -10.99 27.11 65.73 1.52 21.71;

198.19 95.62 38.11 70.95 10.38 5.42 318.33 -11.01 27.11 65.73 1.52 21.71;

198.55 93.53 38.09 70.83 10.55 5.30 318.17 -11.03 27.11 65.73 1.52 21.71;

236.42 114.2 43.98 75.48 10.96 4.43 330.13 -11.77 28.44 58.71 0.89 21.28;

238.09 115.51 45.61 75.83 11.04 4.38 330.50 -9.00 28.44 58.71 0.89 21.28;

236.08 115.26 44.81 75.53 10.86 4.54 330.58 -8.47 28.44 58.71 0.89 21.28;

237.13 116.98 46.42 75.74 10.99 4.42 330.62 -7.87 28.44 58.71 0.89 21.28;

236.26 114.15 45.79 75.55 11.00 4.50 330.70 -7.88 28.44 58.71 0.89 21.28;

235.87 114.96 44.18 75.39 10.92 4.54 330.70 -7.30 28.44 58.71 0.89 21.28;

234.87 114.26 44.16 75.25 10.88 4.44 331.04 -6.46 28.44 58.71 0.89 21.28;

257.31 120.33 41.61 76.55 11.28 3.34 326.37 -21.98 28.39 59.19 0.92 21.34;

257.66 123.59 42.45 76.82 11.12 3.38 326.51 -21.99 28.39 59.19 0.92 21.34;

258.60 124.11 44.78 77.21 11.31 3.40 326.68 -22.01 28.39 59.19 0.92 21.34;

258.93 121.62 43.14 76.88 11.17 3.46 326.71 -22.04 28.39 59.19 0.92 21.34;

258.89 126.70 43.64 77.23 11.28 3.18 326.88 -22.10 28.39 59.19 0.92 21.34;

258.83 122.23 44.80 76.80 11.13 3.51 326.97 -22.00 28.39 59.19 0.92 21.34;

255.65 120.64 42.11 76.39 11.26 3.55 326.86 -22.00 28.39 59.19 0.92 21.34;

278.63 130.81 52.32 79.33 11.52 3.21 334.81 -8.02 28.44 58.71 0.89 21.28;

278.59 134.34 56.56 79.73 11.38 3.23 334.38 -7.63 28.44 58.71 0.89 21.28;

279.90 129.34 55.35 78.93 11.45 3.24 334.71 -9.19 28.44 58.71 0.89 21.28;

279.39 134.25 56.77 79.52 11.39 3.19 334.58 -7.99 28.44 58.71 0.89 21.28;

280.51 129.52 56.48 79.10 11.41 3.42 335.46 -8.75 28.44 58.71 0.89 21.28];

t=[870.21 1.33;

861.36 1.39;

865.99 1.35;

932.58 1.39;

886.16 1.51;

857.29 1.43;

796.22 1.64;

812.25 1.50;

806.31 1.58;

820.05 1.43;

813.55 1.54;

787.42 1.47;

763.85 1.50;

806.07 1.44;

812.31 1.60;

841.98 1.69;

802.31 1.56;

821.58 1.46;

789.26 1.39;

790.71 1.26;

806.05 1.27;

726.86 1.58;

719.52 1.52;

693.61 1.44;

711.83 1.50;

686.92 1.65;

690.98 1.43;

706.55 1.42;

715.76 2.03;

670.06 2.11;

682.39 2.35;

661.88 2.24;

650.79 2.28;

711.22 2.41;

690.13 2.04;

660.24 0.63;

655.71 0.56;

671.92 0.58;

691.91 0.58;

698.31 0.60];

[pn,minp,maxp,tn,mint,maxt]=premnmx(p,t);

net=newff(minmax(pn),[12,14,2],{'tansig','tansig','purelin'},'trainlm');

net.trainParam.lr=0.01;

net.trainParam.epochs=10000;

net.trainParam.goal=1e-4;

[net,tr]=train(net,pn,tn);

a=sim(net,pn);

[a]=postmnmx(a,mint,maxt);

error=[a]-t,

p_test=[135.22 67.40 25.42 59.14 9.66 6.45 295.11 11.33 27.11 65.73 1.52 21.71;

134.56 67.54 25.43 58.98 9.62 6.43 295.59 11.33 27.11 65.73 1.52 21.71;

133.52 66.25 25.45 58.86 9.47 6.60 295.82 11.39 27.11 65.73 1.52 21.71;

164.47 79.97 34.89 61.94 10.14 5.64 303.53 8.15 27.11 65.73 1.52 21.71;

164.58 80.16 30.63 61.93 10.14 5.60 305.83 1.69 27.11 65.73 1.52 21.71;

198.00 95.27 36.67 67.18 10.66 5.60 317.65 -13.73 27.11 65.73 1.52 21.71;

198.10 92.91 36.67 66.82 10.67 5.63 319.09 -10.97 27.11 65.73 1.52 21.71;

198.92 93.36 38.11 70.87 10.34 5.34 318.56 -11.00 27.11 65.73 1.52 21.71;

236.56 116.46 46.52 75.58 11.03 4.43 330.29 -8.99 28.44 58.71 0.89 21.28;

236.19 118.53 47.46 75.84 11.02 4.37 330.85 -5.72 28.44 58.71 0.89 21.28;

256.17 121.89 41.62 76.56 11.11 3.47 326.72 -22.07 28.39 59.19 0.92 21.34;

259.54 124.70 44.45 77.10 11.24 3.25 326.26 -22.06 28.39 59.19 0.92 21.34;

278.47 130.82 53.52 79.08 11.47 3.28 335.20 -8.81 28.44 58.71 0.89 21.28;

279.48 131.38 52.51 79.20 11.49 3.30 334.72 -8.85 28.44 58.71 0.89 21.28;

279.56 131.76 53.00 79.26 11.46 3.34 334.86 -7.99 28.44 58.71 0.89 21.28];

T=[866.90 1.52;

881.32 1.49;

898.59 1.24;

842.11 1.59;

850.54 1.67;

832.91 1.74;

833.91 1.54;

846.77 1.27;

730.21 1.63;

701.22 1.46;

721.10 2.12;

689.40 2.22;

697.28 0.55;

712.67 0.53;

703.55 0.62];

P_test=tramnmx(p_test,minp,maxp);

an=sim(net,P_test);

[an]=postmnmx(an,mint,maxt);

error1=[an]-T,

figure

plot(1:length(t),t,'o',1:length(t),a,'+');

title('o表示预测值———*表示实际值')

grid on

figure

plot(1:length(error),error,'-')

title('误差变化图')

grid on

figure

plot(1:length(error1),error,'-')

title('误差变化图')

以下是错误提示:

??? Error using ==> minus

Matrix dimensions must agree.

Error in ==> premnmx at 84

tn = 2*(t-mint0*oneQ)./((maxt0-mint0)*oneQ) - 1;

Error in ==> bp_feihuiyouhua at 84

[pn,minp,maxp,tn,mint,maxt]=premnmx(p,t);

麻烦各位大侠帮帮忙

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值