Making the assumption to be the same as results

조회 수: 1 (최근 30일)
Kevin Isakayoga
Kevin Isakayoga 2020년 10월 26일
댓글: KSSV 2020년 10월 26일
Hi everyone! I dont know how to fit the parameter of b and n in my code to get the calculation of area equal 1. Could someone help me to modify it? I literally confuse how to fix this up. Thank you in advance before!
ro_init=0.2:0.1:100;
b=0.0517; % assume
n=1.0145; % assume
cdfVdp=(1-exp(-b*((2*ro_init).^n)));
pdfvdp=2*b*n*exp(-b*(2*ro_init).^n).*(2*ro_init).^(n-1);
area=trapz(ro_init,pdfvdp); %this results should be 1
  댓글 수: 2
KSSV
KSSV 2020년 10월 26일
Do you have range of values for b and n?
Kevin Isakayoga
Kevin Isakayoga 2020년 10월 26일
b is from 0 to 0.1 n is from 0.8 to 2

댓글을 달려면 로그인하십시오.

채택된 답변

KSSV
KSSV 2020년 10월 26일
편집: KSSV 2020년 10월 26일
ro_init=0.2:0.1:100;
r = 200 ; c = 200 ; % Try increasing these values
B = linspace(0,0.1,r) ;
N = linspace(0.8,2,c) ;
[B,N] = meshgrid(B,N) ;
A = zeros(r,c) ;
for i = 1:r
for j = 1:c
b=B(i,j) ; % 0.0517; % assume
n=N(i,j) ; % 1.0145; % assume
% cdfVdp=(1-exp(-b*((2*ro_init).^n)));
pdfvdp=2*b*n*exp(-b*(2*ro_init).^n).*(2*ro_init).^(n-1);
area=trapz(ro_init,pdfvdp); %this results should be 1
A(i,j) = area ;
end
end
% GEt area equal to one
idx = abs(A-1)<10^-3 ;
[B(idx) N(idx)] % these are the values of b and n
  댓글 수: 3
Kevin Isakayoga
Kevin Isakayoga 2020년 10월 26일
편집: Kevin Isakayoga 2020년 10월 26일
By the way ,could you help me to explain why are my codes still not working if i change the value? and also what should i change?
clc;clear;
n=1000; %number of trial
rlower=0.002;
rupper=130; % Assume the initial radius in micron meter
r_initial=rlower+(rupper-rlower).*rand(1,n);
r_initial=sort(r_initial);
%r_initial=0.2:0.1:100;
r = 500 ; c = 500 ; % Try increasing these values
B = linspace(0.01,0.09,r) ;
N = linspace(0.9,1.4,c) ;
[B,N] = meshgrid(B,N) ;
A = zeros(r,c) ;
for i = 1:r
for j = 1:c
b=B(i,j) ; % 0.0517; % assume
n=N(i,j) ; % 1.0145; % assume
% cdfVdp=(1-exp(-b*((2*ro_init).^n)));
pdfvdp=2*b*n*exp(-b*(2*r_initial).^n).*(2*r_initial).^(n-1);
area=trapz(r_initial,pdfvdp); %this results should be 1
A(i,j) = area ;
end
end
% GEt area equal to one
idx = abs(A-1)<10^-3 ;
[B(idx) N(idx)] % these are the values of b and n
the answer will be like this,
ans =
0×2 empty double matrix
Looking forward to hearing from you. Thank you!
KSSV
KSSV 2020년 10월 26일
Try decreasing the tolerance value.
idx = abs(A-1)<10^-2 ;

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by