Borrar filtros
Borrar filtros

Listing values for a variable to be solved to an equation

1 visualización (últimos 30 días)
Barry Akenga
Barry Akenga el 1 de Mayo de 2017
Respondida: hmi amid el 1 de Mayo de 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

Respuesta aceptada

hmi amid
hmi amid el 1 de Mayo de 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.

Más respuestas (0)

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by