Can someone check my code for a Monte Carlo and FORM analysis?
1 view (last 30 days)
Show older comments
for Hb=0:1:7, for i = 1:length(samples.hth), Dhsetup=0.5*samples.rair(i)*samples.Cd(i)*samples.U10(i)^2*samples.F(i)/(samples.rsw(i)*samples.g(i)*samples.dbay(i)); % wind set-up Δhset-up n=48; j=(1:n); hbay(j)=1; for j=1:n, if hbay(j)>=Hb Dh(j)=samples.hcoast(i)-hbay(j); else Dh(j)=samples.hcoast(i)-Hb; end Cdf(j)=1-(hbay(j)/samples.hcoast(i))^1.5; Qw(j)=Cdf(j)*samples.Cw(i)*sqrt(samples.g(i))*samples.L(i)*Dh(j)^1.5; hbay(j)=hbay(j)+Qw(j)*samples.Dt(i)/samples.Abay(i)+Dhsetup; end hbay(i)=hbay(j); z(i,:) = samples.hth(i)-hbay(i); % limit state function end end
After runninng it there is an error "Error using FORM (line 219) FORM: derivative dz/du becomes complex for variable(s): "hcoast" Reconsider stochastic variable and z-function to solve the problem."
1 Comment
Bruno Pop-Stefanov
on 9 Oct 2014
Can you please format the code so that it is readable?
What function is form? There is no function in MATLAB called form and I don't see it used anywhere in the code you pasted. Can you paste the line of code that throws the error?
I don't know what this form function is but the message seems to indicate that you should reconsider the variable hcoast because dz/du is complex. Maybe there is something wrong with your z-function or with hcoast?
Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!