Using symbolic Matlab-output from functions 'abs' and 'angle' as input for the 'solve'-function

조회 수: 5 (최근 30일)
clear; clc;
J = 152e-6; % moment of inertia
W = 200*pi; % desired crossover freq
K = 0.1; % torque constant
syms Ki Kp real
assumeAlso(Ki>0);
assumeAlso(Kp>0);
G = Ki/(i*W)*(1 + i*W/(Ki/Kp))*K/(i*W*J); % transfer-function
F = [abs(G) == 1; angle(G) == - 120*pi/180]; % symbolic output (2 equations)
[Ki,Kp] = solve(F,Ki,Kp);
The code produces output:
Warning: Explicit solution could not be found.

답변 (1개)

Ronny Landsverk
Ronny Landsverk 2015년 2월 12일
I found a solution.
clear; clc;
J = 152e-6; % moment of inertia
W = 200*pi; % desired crossover freq
K = 0.1; % torque constant
syms Ki Kp real
assumeAlso(Ki>0);
assumeAlso(Kp>0);
G = Ki/(i*W)*(1 + i*W/(Ki/Kp))*K/(i*W*J); % transfer-function
F = [abs(G), angle(G)]; % symbolic output
H = [rewrite(F(1),'sqrt') == 1, simplify(F(2)) == -120*pi/180]; % 2 equations
[Ki,Kp] = solve(H,Ki,Kp);
So 'rewrite' and 'simplify' made the equations more managable for 'solve'

태그

Community Treasure Hunt

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

Start Hunting!

Translated by