I need help using the quad function
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Bob
am 14 Dez. 2014
Beantwortet: Star Strider
am 14 Dez. 2014
When using the quad function to integrate, I am getting the error:
FUN must be a function, a valid string expression, or an inline function object.
I am trying to integrate the polyval.
Here is my code. How do I fix it to integrate the function and avoid this error message?
function [ A ] = func( x )
clear all clc
A=5;
B=25;
x=[0 10];
y=[A B];
p=polyfit(x,y,1);
func=polyval(p,x);
q=quad(func,0,10)
end
0 Kommentare
Akzeptierte Antwort
Star Strider
am 14 Dez. 2014
To integrate a vector (or matrix in one of its dimensions), use the trapz function. The quad, integral, and related functions integrate functions.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differentiation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!