How to integrate from t-1 to t in MatLab
4 views (last 30 days)
Show older comments
Hello everyone. I am new to Matlab and I am taking a course that requires it. I have been able to integrate without problem up to now. I do not know how to code this so it works. I simply need the integral of x from t-1 to t and then add 2 to that and plot it. I have gotten a error for the dimensions not matching. I am not sure what I am doing wrong and would appreciate any help with this. Kind regards.
clear all
close all
clc
syms x
Ts = 0.01;
t = -10:Ts:10;
y = int(x,t,[t-1, t]);
yt = y + 2;
plot (t,yt)
0 Comments
Answers (2)
Azzi Abdelmalek
on 17 Jul 2016
Something is missing, How x is related to t? look at this example
tt = -10:Ts:10;
syms x t t0
Ts = 0.01;
x=sin(t)
y = int(x,t,[t0-1, t0]);
yt = y + 2;
out=subs(yt,t0,tt)
plot (tt,out)
Image Analyst
on 17 Jul 2016
Is there some equation for the x vs. t curve? Like is x a constant? Or a line or quadratic or a sine wave with respect to t? Also when they say they want the area between (t-1) and t, then probably gave you specific value for t, because the answer will depend on what that value is, as well as what the formula for the x vs. t equation is.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!