creaing a loop with symbols

2 ビュー (過去 30 日間)
Melissa
Melissa 2013 年 12 月 2 日
コメント済み: Melissa 2013 年 12 月 2 日
Good Morning All,
I am trying to make a loop using the sym function. Given the information for a spline interpolation (mmkp function) more specifically the coefficients I want the polynomial as a function. Since the spline is given as order 4 per break, I would have a matrix of [nx1]. So the function would be coefficients(1,1)*x^3+coefficients(1,2)*x^2+coefficients(1,3)*x+coefficients(1,4)+....
%So I have the coefficient information from spline as:
coefs=pp.coefs;
%Creating matrix of x using sym
sym_x=sym('x',[length(coefs),4);
fx=coefs*sym_x;
for i=1:length(coefs)
f(i)=fx(1,n)^3+fx(2,n)^2+fx(3,n)+fx(4,n)
f(i+1)=f(i)+f(i+1)
end
thanks,
Mel

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 12 月 2 日
poly2sym()
  1 件のコメント
Melissa
Melissa 2013 年 12 月 2 日
brilliant! thank you :). Do you know by chance how I can apply this to each row in the stored coeffs?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangePolynomials についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by