Listing values for a variable to be solved to an equation
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to solve for T, time taken to corrosion initiation time using the relative code and equation: X = 0.01; Co = 3.5; D = 5*10^-5; Cth = 0.9; E = erfinv(Cth / Co); T = X^ 2 / [4 * D *( E ^ 2)] Ti= mean(T); Tt= std(T); y = lognpdf(T,Ti,Tt); plot(T,y); grid; Where my question arises is that I am trying to list values for X and so far the code solves for X= 0.01 however I want to solve for T using a range X=0-0.04.What type of code should I use for it? Thanks
댓글 수: 0
채택된 답변
hmi amid
2017년 5월 1일
Hi you should use an array for your X :
X = 0.00:0.001:0.04;
Co = 3.5; D = 5*10^-5; Cth = 0.9; E = erfinv(Cth / Co);
T = X.^ 2 / [4 * D *( E ^ 2)];
Ti= mean(T);
Tt= std(T);
y = lognpdf(T,Ti,Tt);
plot(T,y); grid;
Here the X value goes from 0 to 0.04 with a step of 0.001 And also be careful to put a dot before ^ in X.^2 because it should consider the square of each element in the array.
Amid.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!