How to draw the function relationship graph between two or three variables, where these variables are solved by a system of equations.

27 visualizzazioni (ultimi 30 giorni)
% 定义符号变量 VL=20;
syms tc t2 Q_out Vco Vcn VL
%参数关系
L=100e-9;
C=50e-6;
Z=sqrt(L/C);
omega=1/sqrt(L*C);
VH=24;
Io=4;
T=2*pi*sqrt(L*C);
% 第一个方程
eqn1 = Io*(tc + t2 + T/2) - Q_out;
% 第二个方程
eqn2 = Vco - (VL + 1/2 * Q_out/C);
% 第三个方程
eqn3 = Vcn - (VL - 1/2 * Q_out/C);
% 第四个方程
eqn4 = 1/2 * tc^2 * (VH - Vcn)/Z * (2*pi/T) - (VL/VH) * Q_out;
% 第五个方程
eqn5 = t2/tc - (VH - Vcn)/Vco;
In this program, there are five equations and six variables. The one-to-one relationship between \(t_c\) and \(V_L\) can be solved, that is, given a \(V_L\), the only \(t_c\) that meets the conditions can be solved. \(t_c\) is a very short time quantity, so only positive values are taken. Then how can I draw the function relationship between \(t_c\) and \(V_L\)? Because there is no obvious functional relationship between the two. On this basis, if \(Z\) is introduced, resulting in 7 variables and 5 equations, how to draw the three-dimensional function image of \(V_L\) changing with \(t_c\) and \(Z\)?

Risposte (2)

John D'Errico
John D'Errico il 14 Nov 2024 alle 12:54
Modificato: John D'Errico il 14 Nov 2024 alle 12:55
Not everything you might want to do has an answer. You ask to "draw" the relationship between variables. (For a fairly vaguely specified problem, where you talk about adding a new unspecified equation, so I assume you are asking about how one might solve a general problem.)
I'm not sure if by this you mean to plot something, or merely to be able to write down some simple formula. In either case, this is often an impossible problem to solve. And sometimes, provably impossible. Why do I say impossible? Moderately large systems of nonlinear equations tend to be reducible to smaller systems of equations, but of higher polynomial order.
In your case, you have polynomial-like things, but with square roots sprinkled about. So if we eliminate one variable, then the equations that remain get more complicated, with higher (and often fractional) powers.
Why is this a problem? You may have learned about the old proof that polynomials of degree higher than 4 will generally have no algebraic solution. Yes, there are some trivial cases where this is not true. But for the general non-constant coefficient polynomial of degree 5 or higher, there will be no solutions possible. EVER. It goes back to Abel-Ruffini, so long before any of us reading this were born.
The point is, if your problem reduces in some way to solving for the solution of a general, non-constant coefficient, degree 5 or higher polynomial, then nothing you will ask to do has a solution. As much as you want it to have a solution, you will hit a brick wall. Again, that need not always be the case. because sometimes you will be able to find a pretty trick to reduce things. That is why mathematicians get paid the big bucks. (Yeah, right. Ok, maybe better mathematicians than me.) But you are asking for a general approach on how to solve a very generic problem. And that general scheme does not exist, that will apply to any general problem.
  1 Commento
ruan
ruan il 14 Nov 2024 alle 13:12
I want to generate an array with 100 items for tc, and then take one value from it respectively to solve the system of equations and get a VL. Extract the values that meet the conditions and put them into another array. After solving the system of equations 100 times like this, 100 corresponding points can be obtained, and then the graphical relationship between and can be drawn. But I don't know how to implement it with code, because several values of will be obtained each time the equations are solved, and I only need the one between 0 and 24, and this value is often unique.

Accedi per commentare.


Torsten
Torsten il 14 Nov 2024 alle 12:54
Modificato: Torsten il 14 Nov 2024 alle 13:25
Here are the three possible solutions for VL given tc.
% 定义符号变量 VL=20;
syms tc t2 Q_out Vco Vcn VL
%参数关系
L=100e-9;
C=50e-6;
Z=sqrt(L/C);
omega=1/sqrt(L*C);
VH=24;
Io=4;
T=2*pi*sqrt(L*C);
% 第一个方程
eqn1 = Io*(tc + t2 + T/2) - Q_out == 0;
% 第二个方程
eqn2 = Vco - (VL + 1/2 * Q_out/C) == 0;
% 第三个方程
eqn3 = Vcn - (VL - 1/2 * Q_out/C) == 0;
% 第四个方程
eqn4 = 1/2 * tc^2 * (VH - Vcn)/Z * (2*pi/T) - (VL/VH) * Q_out == 0;
% 第五个方程
eqn5 = t2/tc - (VH - Vcn)/Vco == 0;
S = solve([eqn1,eqn2,eqn3,eqn4,eqn5],[VL t2 Q_out Vco Vcn],'MaxDegree',3)
Warning: Solutions are only valid under certain conditions. To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
S = struct with fields:
VL: [3x1 sym] t2: [3x1 sym] Q_out: [3x1 sym] Vco: [3x1 sym] Vcn: [3x1 sym]
%Example: Compute VL for tc = 1
format long
VL_num = double(subs(S.VL,tc,1))
VL_num =
1.0e+12 * 0.000000000012000 + 0.000000000000000i 0.000000040024280 - 0.000000000000000i 2.400000039988001 + 0.000000000000000i
VL_num = VL_num(abs(imag(VL_num))<1e-8);
VL_num = real(VL_num);
VL_num = VL_num(VL_num >= 0 & VL_num <= 24)
VL_num =
12.000000000119982

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Tag

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by