Borrar filtros
Borrar filtros

i am stuck in this problem ive been trying all day and dont know from where to start. could you please help

2 visualizaciones (últimos 30 días)
  2 comentarios
Steven Lord
Steven Lord el 8 de Abr. de 2024
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
Zahida
Zahida el 8 de Abr. de 2024
this is a tutorial sheet i started out by doing the following code below but dont know if its correct

Iniciar sesión para comentar.

Respuestas (1)

Neelanshu
Neelanshu el 15 de Abr. de 2024
Hi Zahida,
As Steven mentioned, the question appears to be a homework assignment. Additionally, I couldn't find the "trap" function in the documentation.
I am providing you with some hints to get started on the problem. To solve the equations mentioned, you can refer to the mathematical expressions for the Simpson's and Trapezoidal rules as shown below:
Simpson's 1/3 rule
Simpson's 3/8 rule =
Trapezoidal rule =
Here is an example for the trapezoidal rule :
% Trapezoidal rule
a = -2; b = 4;
f = @(x) 1-x-4*x^3+2*x^5;
trap = (b-a)/2*(f(a)+f(b))
You have to use multiple segment versions of the above mentioned rules for the parts c and e. For the analytical solution, you may refer the following documentation to learn more about function "int" :
Hope this helps.
  1 comentario
John D'Errico
John D'Errico el 15 de Abr. de 2024
+1. It is so rare that I find a good example of someone looking to help guide a student in their assignment, instead of just doing it for them. This is a great example of someone offering guidance. Thank you. A nudge in the right direction is a good thing.
I would comment that there is indeed no function named trap in MATLAB. It might be something the user would choose to write though, as one way to implement the trapezoidal integration. So it could evaluate one panel of the trapezoidal rule. Then just call it 2 or 4 times, depending on how many panels would be needed.
And that would in turn suggest the possible use of a loop, to generate those multiple panels needed for the multi-point parts of this question (thus part c for the question.)

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by