Hi There, I want to write a code to solve the following two polynomials to write them in Simulink block]
I have 39 values of Cn, S, t, u, v for the first polynomial and 47 values for the same variable for the second polynomial. Many Thanks in advance.

 채택된 답변

Walter Roberson
Walter Roberson 2015년 9월 7일

0 개 추천

You cannot use a Polynomial block for those because those are not polynomials. Polynomials do not raise values to powers that are variables.
I think you will need to use a MATLAB Function Block.

댓글 수: 4

ameen
ameen 2015년 9월 8일
That's what i will do. However, i need help with writing a code to solve these equations.
K = sum( C .* J.^S .* (P./D).^t .* (AE./A0).^u .* z.^v );
And use this same function twice with the different sets of inputs, since the formula is the same for both cases.
ameen
ameen 2015년 9월 10일
Thank you for your help. I used a FOR loop to do it.
You would not need a "for" loop to do it. I coded as a vectorized expression that should be fine as long as all of the elements are either scalar or the same length. If some of the arrays might be longer you can index them at the length you want. For example,
N = 37;
K = sum( C(1:N) .* J.^S(1:N) .* (P./D).^t(1:N) .* (AE./A0).^u(1:N) .* z.^v(1:N) );

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Polynomials에 대해 자세히 알아보기

제품

질문:

2015년 9월 7일

댓글:

2015년 9월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by