Goal seek excel function in MATLAB.

21 ビュー (過去 30 日間)
Alexander Guillen
Alexander Guillen 2022 年 3 月 29 日
Thank you in advance for any guidance or help. I am not sure if it will be hard to understand what I am trying to achieve but here I go.
I am aware of a function in excel called goalseek which allows me to vary column T ( which is temperature) to column p ( total pressure) in order to make this column match p_target so in the end column p will be a column of just 1 in it . I can do this in excel but would like learn how to do this in matlab. My code is below. I would appreciate any guidance, help or links that maybe answer my question.
clear all; close all; clc
p_target = 1; % bar
T= 300:5:330;
x1 = linspace(0,1,7);
x2 = 1-x1;
% Calculating the pressure 1 and 2
% Water- Antoine parameters
a = 4.6543; b = 1435; c = -64.848;
p1_pure = Antoine(a,b,c,T);
p1 = transpose(p1_pure.*x1);
% Benzene: Antoine parameters
a = 4.01814; b = 1203; c = -53.226;
p2_pure = Antoine(a,b,c,T);
p2 = transpose(p2_pure.*x2);
% Total pressure
p = p1+p2;
y1 = p1./p;
y2 = p2./p;
OUTPUT = [p1,p2,y1,y2]

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by