x1 = 0:.1:5; x2 = x1; for i = 1:length(x1); for j = 1:length(x2) gx(i,j) = 4-x1(i)^2-x2(j)^2; end end surf(x1,x2,gx'); hold Current plot held surf(x1,x2,zeros(length(x1)); ??? surf(x1,x2,zeros(length(x1)); | {Error: Unbalanced or unexpected parenthesis or bracket. } surf(x1,x2,zeros(length(x1))); view(2) u1 = -4:.1:4; u2 = u1; for i = 1:length(u1) for j = 1:length(u2) gu(i,j) = 4-(-log(1-normcdf(u1(i))))^2 - (-2*log(1-normcdf(u2(j))))^2; end end figure surf(u1,u2,gu'); hold on;surf(u1,u2,zeros(length(u1))); hold on;surf(u1,u2,zeros(length(u1))); view(2) for i = 1:length(u1) for j = 1:length(u2) fu1u2(i,j) = mvnpdf([u1(i),u2(j)]); end end figure surf(u1,u2,fu1u2'); gufail = fu1u2*(gu<0)*1.0; figure surf(u1,u2,gufail'); gufail = fu1u2.*(gu<0)*1.0; figure surf(u1,u2,gufail'); view(2) x1r = exprnd(1,100000,1); mean(x1r) ans = 0.9998 x2r = exprnd(2,100000,1); mean(x2r) ans = 1.9966 pfx = sum(4-x1r.^2-x2r.^2<0)/100000 pfx = 0.4973 u1r = randn(100000,1); u2r = randn(100000,1); gur = 4-(-log(1-normcdf(u1r))).^2 - (-2*log(1-normcdf(u2r))).^2; whos Name Size Bytes Class Attributes ans 1x1 8 double fu1u2 81x81 52488 double gu 81x81 52488 double gufail 81x81 52488 double gur 100000x1 800000 double gx 51x51 20808 double i 1x1 8 double j 1x1 8 double pfx 1x1 8 double u1 1x81 648 double u1r 100000x1 800000 double u2 1x81 648 double u2r 100000x1 800000 double wind_speed 166440x1 1331520 double wind_speed_daily 1x6935 55480 double wind_speed_yearly 8760x19 1331520 double wind_time 166440x1 1331520 double wind_time_daily 1x6935 55480 double wind_time_yearly 8760x19 1331520 double x1 1x51 408 double x1r 100000x1 800000 double x2 1x51 408 double x2r 100000x1 800000 double pfu = sum(gur<0)/100000 pfu = 0.4970 u1g = -1/.4*(1+2*log(1-normcdf(u2))); plot(u1g,u2) hold Current plot held plot(0,0,'x'); axis equal plot(1,1.864,'go') plot(1,-1.57,'go') plot(-1.57,1,'go') u1g = -1/.4*(1+.2*log(1-normcdf(u2))); plot(u1g,u2) hold Current plot held plot(0,0,'x'); plot(-1.57,1,'go') axis equal diary(off) {??? Undefined function or variable 'off'. } diary off