Filter löschen
Filter löschen

Listing values for a variable to be solved to an equation

1 Ansicht (letzte 30 Tage)
Barry Akenga
Barry Akenga am 1 Mai 2017
Beantwortet: hmi amid am 1 Mai 2017
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

Akzeptierte Antwort

hmi amid
hmi amid am 1 Mai 2017
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.

Weitere Antworten (0)

Kategorien

Mehr zu Linear Algebra finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by