查找3d线图下方的总值

时间:2014-02-26 12:09:44

标签: matlab

所以我使用以下代码在MATLAB中创建了3D填充线图:

  for k = 1: P
   for j = 1: L
    X22 = linspace(0,b*1000,N+1);
    Y22 = Yijk(j,:,k);
    n = length(X22);
    Z22 = contact_force(j,:,k);

    Xp2 = zeros(2*n,1);
    Yp2 = zeros(2*n,1);

    Xp2(1:n) = X22;
    Xp2(n+1:2*n) = X22(n:-1:1);
    Yp2(1:n) = Y22;
    Yp2(n+1:2*n) = Y22(n:-1:1);
    Zp2(1:n) = 0;
    Zp2(n+1:2*n) = Z22(n:-1:1);

    figure(100+k);
    hold on
    fill3(Xp2,Yp2,Zp2,'c');
    hold off
    title(['Contact force at fraction '...
        num2str(-1*((k-P)/P)) ' of base pitch'])
   end
  end 

创建以下图像:

http://oi57.tinypic.com/2a0dy61.jpg

我想找到每条蓝线的总价值,我该怎么做?

1 个答案:

答案 0 :(得分:0)

求和曲线下面积:

sumZ = 0;
for k = 1: P
   for j = 1: L
    X22 = linspace(0,b*1000,N+1);
    Y22 = Yijk(j,:,k);
    n = length(X22);
    Z22 = contact_force(j,:,k);

    Xp2 = zeros(2*n,1);
    Yp2 = zeros(2*n,1);

    Xp2(1:n) = X22;
    Xp2(n+1:2*n) = X22(n:-1:1);
    Yp2(1:n) = Y22;
    Yp2(n+1:2*n) = Y22(n:-1:1);
    Zp2(1:n) = 0;
    Zp2(n+1:2*n) = Z22(n:-1:1);

    sumZ = sumZ+Zp2;

    figure(100+k);
    hold on
    fill3(Xp2,Yp2,Zp2,'c');
    hold off
    title(['Contact force at fraction '...
        num2str(-1*((k-P)/P)) ' of base pitch'])
   end
  end