필터 지우기
필터 지우기

Listing values for a variable to be solved to an equation

조회 수: 1 (최근 30일)
Barry Akenga
Barry Akenga 2017년 5월 1일
답변: hmi amid 2017년 5월 1일
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

채택된 답변

hmi amid
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개)

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by