89456418961 2021-12-23 15:40 采纳率: 84.6%
浏览 50
已结题

关于#MATLAB#的问题,如何解决?

clc;
clear;
close all;
W=3000;
a2=14 ;
d=0.8;
xr1=1;               
xg1=1;               
xb1=1;               

xr=0.6569;
yr=0.3179;

xg=0.2939;
yg=0.6390;

xb=0.1624;
yb=0.0525;

xw=0.2990;
yw=0.3331;

Rpr=0.9;
Gpr=0.7;
Bpr=0.75;

Rel=22.25;
Gel=21.70;
Bel=22.40;
Margin=0.00;

JR=19.21;
JG=19.21;
JB=19.21;

RT95=800;
GT95=800;
BT95=800;


zr=1-xr-yr;
XYr=xr/yr;
YYr=1;
ZYr=zr/yr;
ur=4*xr/(3-2*xr+12*yr);
vr=9*yr/(3-2*xr+12*yr);
%
zg=1-xg-yg;
XYg=xg/yg;
YYg=1;
ZYg=zg/yg;
ug=4*xg/(3-2*xg+12*yg);
vg=9*yg/(3-2*xg+12*yg);
%
zb=1-xb-yb;
XYb=xb/yb;
YYb=1;
ZYb=zb/yb;
ub=4*xb/(3-2*xb+12*yb);
vb=9*yb/(3-2*xb+12*yb);
%
zw=1-xw-yw;
XYw=xw/yw*W;
YYw=1*W;
ZYw=zw/yw*W;
uw=4*xw/(3-2*xw+12*yw);
vw=9*yw/(3-2*xw+12*yw);
%
a=[XYr XYg XYb;YYr YYg YYb;ZYr ZYg ZYb];
b=inv(a);
a1=[XYw YYw ZYw];
b1=a1.*b;

R1=b1(1,:);
R=sum((sum(R1)));

G1=b1(2,:);
G=sum((sum(G1)));

B1=b1(3,:);
B=sum((sum(B1)));

%fprintf(' R:%.2f\n G:%.2f\n B:%.2f\n R+G+B=%.2f\n',R,G,B,R+B+G);
xr1=0.1;
for i=1:9
    xr1(i+1)=0.1+0.1*i;
    
% 
x0=[3,3,3,3];      % 初始参考点
fun=@(x)[
        (2*a2*a2)^(1/2) - (x(4)+2*d+x(2)),...
        (2*a2*a2)^(1/2) - (x(1)+2*d+x(3)),...
        ((x(1)*x(1))/(2*a2*a2))/((x(2)*x(3))/(a2*a2))  - xr1/xg1,...
        ((x(1)*x(1))/(2*a2*a2))/((x(4)*x(4))/(2*a2*a2))- xr1/xb1,...
        ((x(2)*x(3))/(a2*a2))/((x(4)*x(4))/(2*a2*a2))  - xg1/xb1,...
       ];
x=fsolve(fun,x0);    %调用函数

xr2=(x(1).*x(1))/(2.*a2.*a2);
xg2=(x(2)*x(3))/(a2*a2);
xb2=(x(4)*x(4))/(2*a2*a2);
% fprintf('Aperture Ratio:R:%.2f%%  G:%.2f%%  B:%.2f%%',xr2*100,xg2*100,xb2*100);
Rsub=R/Rpr/xr2;
Gsub=G/Gpr/xg2;
Bsub=B/Bpr/xb2;

rel=Rel*(1-Margin);
gel=Gel*(1-Margin);
bel=Bel*(1-Margin);

Jr=(Rsub*1000/rel)/10000;
Jg=(Gsub*1000/gel)/10000;
Jb=(Bsub*1000/bel)/10000;

Rt95=(JR/Jr)^1.5*RT95;
Gt95=(JG/Jg)^1.5*GT95;
Bt95=(JB/Jb)^1.5*BT95;
% T95
T95=W/((R/Rt95)+(G/Gt95)+(B/Bt95));

%
Xr=xr/yr;
Yr=1;
Zr=(1-xr-yr)/yr;

Xg=xg/yg;
Yg=1;
Zg=(1-xg-yg)/yg;

Xb=xb/yb;
Yb=1;
Zb=(1-xb-yb)/yb;

R2=(1-0.05*T95/Rt95)*R;
G2=(1-0.05*T95/Gt95)*G;
B2=(1-0.05*T95/Bt95)*B;
% 
Xw=R2*Xr+G2*Xg+B2*Xb;
Yw=R2+G2+B2;
Zw=R2*Zr+G2*Zg+B2*Zb;

xw1=Xw./(Xw+Yw+Zw);
yw1=Yw./(Xw+Yw+Zw);
uw1=4*xw1./(3-2*xw1+12*yw1);
vw1=9*yw1./(3-2*xw1+12*yw1);
uv=((uw-uw1).*(uw-uw1)+(vw-vw1).*(vw-vw1));
%  
uv=sqrt(uv);


end

plot(xr1,T95,'R',xr1,uv,'R')
hold on

想得到xr1=0.1-1和T95和uv的曲线
程序不知道哪里有问题

  • 写回答

1条回答 默认 最新

  • 朗风风 2021-12-23 20:56
    关注
    clc;
    clear;
    close all;
    W=3000;
    a2=14 ;
    d=0.8;
    xr1=1;               
    xg1=1;               
    xb1=1;               
    xr=0.6569;
    yr=0.3179;
    xg=0.2939;
    yg=0.6390;
    xb=0.1624;
    yb=0.0525;
    xw=0.2990;
    yw=0.3331;
    Rpr=0.9;
    Gpr=0.7;
    Bpr=0.75;
    Rel=22.25;
    Gel=21.70;
    Bel=22.40;
    Margin=0.00;
    JR=19.21;
    JG=19.21;
    JB=19.21;
    RT95=800;
    GT95=800;
    BT95=800;
     
    zr=1-xr-yr;
    XYr=xr/yr;
    YYr=1;
    ZYr=zr/yr;
    ur=4*xr/(3-2*xr+12*yr);
    vr=9*yr/(3-2*xr+12*yr);
    %
    zg=1-xg-yg;
    XYg=xg/yg;
    YYg=1;
    ZYg=zg/yg;
    ug=4*xg/(3-2*xg+12*yg);
    vg=9*yg/(3-2*xg+12*yg);
    %
    zb=1-xb-yb;
    XYb=xb/yb;
    YYb=1;
    ZYb=zb/yb;
    ub=4*xb/(3-2*xb+12*yb);
    vb=9*yb/(3-2*xb+12*yb);
    %
    zw=1-xw-yw;
    XYw=xw/yw*W;
    YYw=1*W;
    ZYw=zw/yw*W;
    uw=4*xw/(3-2*xw+12*yw);
    vw=9*yw/(3-2*xw+12*yw);
    %
    a=[XYr XYg XYb;YYr YYg YYb;ZYr ZYg ZYb];
    b=inv(a);
    a1=[XYw YYw ZYw];
    b1=a1.*b;
    R1=b1(1,:);
    R=sum((sum(R1)));
    G1=b1(2,:);
    G=sum((sum(G1)));
    B1=b1(3,:);
    B=sum((sum(B1)));
    %fprintf(' R:%.2f\n G:%.2f\n B:%.2f\n R+G+B=%.2f\n',R,G,B,R+B+G);
    xr1=0.1;
    T95=[]
    
    for i=1:9
        xr1(i+1)=0.1+0.1*i;
    % 
    x0=[3,3,3,3];      % 初始参考点
    fun=@(x)[
            (2*a2*a2)^(1/2) - (x(4)+2*d+x(2)),...
            (2*a2*a2)^(1/2) - (x(1)+2*d+x(3)),...
            ((x(1)*x(1))/(2*a2*a2))/((x(2)*x(3))/(a2*a2))  - xr1/xg1,...
            ((x(1)*x(1))/(2*a2*a2))/((x(4)*x(4))/(2*a2*a2))- xr1/xb1,...
            ((x(2)*x(3))/(a2*a2))/((x(4)*x(4))/(2*a2*a2))  - xg1/xb1,...
           ];
    x=fsolve(fun,x0);    %调用函数
    xr2=(x(1).*x(1))/(2.*a2.*a2);
    xg2=(x(2)*x(3))/(a2*a2);
    xb2=(x(4)*x(4))/(2*a2*a2);
    % fprintf('Aperture Ratio:R:%.2f%%  G:%.2f%%  B:%.2f%%',xr2*100,xg2*100,xb2*100);
    Rsub=R/Rpr/xr2;
    Gsub=G/Gpr/xg2;
    Bsub=B/Bpr/xb2;
    rel=Rel*(1-Margin);
    gel=Gel*(1-Margin);
    bel=Bel*(1-Margin);
    Jr=(Rsub*1000/rel)/10000;
    Jg=(Gsub*1000/gel)/10000;
    Jb=(Bsub*1000/bel)/10000;
    Rt95=(JR/Jr)^1.5*RT95;
    Gt95=(JG/Jg)^1.5*GT95;
    Bt95=(JB/Jb)^1.5*BT95;
    % T95
    T95=[T95,W/((R/Rt95)+(G/Gt95)+(B/Bt95))];
    
    %
    Xr=xr/yr;
    Yr=1;
    Zr=(1-xr-yr)/yr;
    Xg=xg/yg;
    Yg=1;
    Zg=(1-xg-yg)/yg;
    Xb=xb/yb;
    Yb=1;
    Zb=(1-xb-yb)/yb;
    R2=(1-0.05*T95/Rt95)*R;
    G2=(1-0.05*T95/Gt95)*G;
    B2=(1-0.05*T95/Bt95)*B;
    % 
    Xw=R2*Xr+G2*Xg+B2*Xb;
    Yw=R2+G2+B2;
    Zw=R2*Zr+G2*Zg+B2*Zb;
    xw1=Xw./(Xw+Yw+Zw);
    yw1=Yw./(Xw+Yw+Zw);
    uw1=4*xw1./(3-2*xw1+12*yw1);
    vw1=9*yw1./(3-2*xw1+12*yw1);
    uv=((uw-uw1).*(uw-uw1)+(vw-vw1).*(vw-vw1));
    %  
    uv=sqrt(uv);
    end
    plot(xr1(2:1:end),T95,'b',xr1(2:1:end),uv,'R')
    legend('T95','uv')
    hold on
     
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
    1人已打赏

报告相同问题?

问题事件

  • 系统已结题 1月1日
  • 已采纳回答 12月24日
  • 创建了问题 12月23日

悬赏问题

  • ¥66 定制开发肯德基自动化网站下单软件
  • ¥20 vscode虚拟环境依赖包未安装
  • ¥15 odoo17关于owl开发js代码问题
  • ¥15 光纤中多普勒频移公式的推导
  • ¥15 怎么制作一个人脸识别门禁系统
  • ¥20 大华dss监控平台网络关闭登不进去
  • ¥15 请使用蚁群算法解决下列问题,并给出我完整的代码
  • ¥20 关于php录入完成后,批量更新数据库
  • ¥15 请教往复密封润滑问题
  • ¥15 cocos creator发布ios包