Listing values for a variable to be solved to an equation
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Barry Akenga
le 1 Mai 2017
Réponse apportée : hmi amid
le 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
0 commentaires
Réponse acceptée
hmi amid
le 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.
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!