So I have a bit of an issue. I have a matrix with coefficients on top and powers of x on bottom (e.g. var = [3 4, 2 1]; where the corresponding equation is f(x) = 3x^2 + 4x) The code is set up to allow the user to enter a matrix of any length with 2 rows. I need to integrate whatever function they input in this format. How do I make a function that will change depending on what they enter?

 채택된 답변

madhan ravi
madhan ravi 2018년 10월 16일
편집: madhan ravi 2018년 10월 16일

0 개 추천

var = input('enter 2 by 2 matrix');
f = @(x) input('enter equation like 3*x.^2 + 4*x for example')
f(var)
Like this?

추가 답변 (0개)

카테고리

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

질문:

2018년 10월 16일

편집:

2018년 10월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by