Function Display As Is

조회 수: 5 (최근 30일)
Marino Kosorcic
Marino Kosorcic 2019년 4월 27일
댓글: Christopher Chock 2022년 9월 15일
Hi all,
I wish to display a transfer function in the form that is shown below.
9wmUiBglo4.png
I am having trouble with the 5*(s+15) term, as MATLAB is by default distributing the 5 into the function and displaying 5*(s+75).
I wrote a MATLAB function which prompts the user for input polynomials and displays the output as the ratio of factors and as the ratio of polynomials once the factors are expanded.
function [factors,polynomials] = test(numpoly,denpoly)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
syms s
numpoly = input('Please enter numerator polynomial as a function of s: ')
denpoly = input('Please enter denominator polynomial as a function of s: ')
factors = (numpoly/denpoly)
polynomials = expand(numpoly)/expand(denpoly)
pretty(factors)
pretty(polynomials)
end
%And the Outputs:
% (5 s + 75) (s + 26) (s + 72)
% ----------------------------
% 2 2
% s (s + 56) (s + 5 s + 30)
%
% 3 2
% 5 s + 565 s + 16710 s + 140400
% ------------------------------------------
% 5 4 3 2
% s + 117 s + 3726 s + 19040 s + 94080 s
  댓글 수: 1
Christopher Chock
Christopher Chock 2022년 9월 15일
This should help!
https://www.mathworks.com/help/control/ug/transfer-functions.html

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2019년 4월 27일
Maybe try this:
s = linspace(0.1, 10, 1000);
numerator = 5 * (s + 15) .* (s + 26) .* (s + 72);
denominator = s .* (s + 56).^2 .* (s.^2 + 5 * s + 30);
H = numerator ./ denominator;
plot(s, H, 'b.-');
grid on;
xlabel('s', 'FontSize', 20);
ylabel('H', 'FontSize', 20);
0000 Screenshot.png
  댓글 수: 1
Marino Kosorcic
Marino Kosorcic 2019년 4월 27일
Sorry I must clarify. My task is to display the actual mathematical equation in the two forms: As a ratio of factors and as a ratio of polynomials.
The issue that I am having is in displaying the equation as a ratio of factors. Particularly in displaying 5*(s+15) as it is and not as (5*s+75).

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Polynomials에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by