Can you write a code for the following hyperbolic function?

2 views (last 30 days)
Can someone write a matlab code to solve the following integral? I have give the limits for the Q_0 and also the y_m value for each X_0 that needs to be calculated. I need a single code that provides me the results for each Q_0. Thanks!
  3 Comments
Rajdeep
Rajdeep on 21 Sep 2022
I did excute the code, but as you can see the values in the result doesn't match from what I need with respect to y_m. What changes should I make in the code?

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 21 Sep 2022
Your sqrt() was ending too early. I made exactly the same mistake when I typed into my own session.
format short g
y_m_vals = [0.1945; 0.3890; 0.5835; 0.7780; 0.9725; 1.1670; 1.3615];
q_0_vals = [2.26; 2.24; 2.19; 2.12; 1.90; 1.48; 0.72];
syms q y_m q_0
f(y_m, q_0) = int(sqrt((q^2/2 + cosh(y_m))^2 - 1), q, 0, q_0)
f(y_m, q_0) = 
x_0 = double([y_m_vals, q_0_vals, f(y_m_vals, q_0_vals)])
x_0 = 7×3
0.1945 2.26 3.332 0.389 2.24 3.4679 0.5835 2.19 3.5985 0.778 2.12 3.7512 0.9725 1.9 3.4948 1.167 1.48 2.7669 1.3615 0.72 1.3827
  2 Comments
Image Analyst
Image Analyst on 21 Sep 2022
Please click the "Accept this answer" link to award @Walter Roberson reputation points. 🙂

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!