how can we increase a value until we get answer
Afficher commentaires plus anciens
clc
clear all
% -------------------------------------data input-----------------------------------
alpha = [510; 310; 78; 120; 350; 490; 53; 150; 170; 149];
beta = [7.20; 7.85; 7.98; 7.10; 7.30; 6.90; 8.01; 7.30; 7.42; 7.16];
gamma = [0.00142; 0.00194; 0.00482; 0.00321; 0.00210; 0.00178; 0.00212; 0.00350; 0.00267; 0.00390];
delta = [0.0000001; 0.0000002; 0.0000003; 0.0000001; 0.0000002; 0.0000003; 0.0000001; 0.0000002; 0.0000003; 0.0000001];
% Pmin =[150; 100; 50; 50; 100; 100; 100; 100; 100; 100];
% Pmax =[600; 400; 200; 200; 350; 500; 300; 300; 300; 300];
n = 10;
Pr = 2500;
L = 8.6;
%--------------------------------------Program start here--------------------------------
while eps >= 0.001
L =
syms P
% P = sym('P');
% L = sym('L');
F = sym('F');
Lambda = sym('Lambda');
% n = length(alpha);
for i = 1:n
F(i) = alpha(i) + beta(i).*P + gamma(i).*P.^2 + delta(i).*P.^3;
disp(F(i))
Lambda = diff(F(i),P) - L == 0;
disp(Lambda);
S = solve(Lambda, P);
disp(S)
S1 = max(S)
% disp(S1)
X(i) = S1
% W = vpa(X(i),6)
double(X)
end
Pt = sum(X)
disp(Pt)
double(Pt)
eps = 2500 - double(Pt)
double(eps)
end
i want to increase L until i get eps >=0.01
for example i wanna increase L 0.01.....l=8.01,8.02,8.03
1 commentaire
Image Analyst
le 28 Déc 2021
eps is a built-in function that gives the smallest number that can be represented. It's value depends on the value of the variable. Like eps around 2 is different than eps around 10^30. That is why eps() can take a input number.
You should not use eps as the name of your own custom variable because it is a built-in function.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Matrix Computations dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!