i want to solve definite integral with variable limits . can i apply trapezoidal rule for the same?
4 views (last 30 days)
Show older comments
neetika sharma
on 25 May 2018
Commented: neetika sharma
on 31 May 2018
t0 = Id/(G0*(Vg-Vt-Id*Rs))
t1 = Id/(G0*(Vg-Vt-Vd+Id*Rd))
r = integral(@(t)1./(t.^2.*log(1-t)),t0,t1);
Id=A/r
where,
G0 = 0.132;
Vg = 0;
Vt = -.485;
Rs = 0.023;
Rd = 0.022;
Id = .003
1 Comment
John D'Errico
on 25 May 2018
Edited: John D'Errico
on 25 May 2018
I fixed your code to be readable. I don't think you have the hang of it yet.
https://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup#answer_18099
Accepted Answer
John D'Errico
on 25 May 2018
Can you generate a set of values for t between t0 and t1? Yes. Use linspace.
Can you evaluate that function at those points? Why not?
t = linspace(t0,t1,100);
fun = @(t)1./(t.^2.*log(1-t));
trapz(t,fun(t))
Your code is incomplete, since it fails to define Vd. So I cannot run your code to show that it works.
4 Comments
John D'Errico
on 29 May 2018
You cannot put a loop around that, varying the value of Vd, and plot the result?
Either store the intermediate results, and plot it all at the end of the loop, or plot each point one at a time, and use "hold on" to force each new point on the plot to be added to the existing plot.
More Answers (0)
See Also
Categories
Find more on Two y-axis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!