-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheckErrorBetweenSolutions.m
More file actions
29 lines (22 loc) · 1.06 KB
/
checkErrorBetweenSolutions.m
File metadata and controls
29 lines (22 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
% Define symbolic variables
syms a1 a2 a3 a4 C1 C2 C3 C4 k x
% phiSol1 in exponential form
phiSol1 = a1 * exp(-x * k) + a2 * exp(x * k) + ...
a3 * exp(-x * k * 1i) + a4 * exp(x * k * 1i);
% phiSol2 in trigonometric and hyperbolic form
phiSol2 = C1 * sin(k * x) + C2 * cos(k * x) + ...
C3 * sinh(k * x) + C4 * cosh(k * x);
% Transform phiSol1 into trigonometric and hyperbolic forms using Euler's formula
phiSol1_transformed = simplify(expand(phiSol1));
% Display the transformed phiSol1 and original phiSol2 for visual comparison
disp('Transformed phiSol1:');
disp(phiSol1_transformed);
disp('Original phiSol2:');
disp(phiSol2);
% Assuming structural equivalence, set up equations to find the relationship between coefficients
coeffs_eqns = [a1 + a2 == C4, a1 - a2 == C3, a3 + a4 == C2, 1i*(a4 - a3) == C1];
% Solve the equations for the coefficients
coeffs_solutions = solve(coeffs_eqns, [a1, a2, a3, a4]);
% Display the relationships between the coefficients
disp('Relationships between coefficients:');
disp(coeffs_solutions);