clear all;
close all force;
clc;
syms x y frequency amplitude phase
f_sin = 'amplitude * sin(x * frequency + phase) = y';
f_sin_const = subs(f_sin, [frequency amplitude phase], [2 0.5 pi]);
ezplot(f_sin_const, [0, pi, -0.5, 0.5])
hold on;
%Calculate the 3 points
x_vals = [0, pi / 4, pi / 2];
y_vals = [];
temp = subs(f_sin_const, x, x_vals(1));
y_vals(1) = solve(temp, y);
temp = subs(f_sin_const, x, x_vals(2));
y_vals(2) = solve(temp, y);
temp = subs(f_sin_const, x, x_vals(3));
y_vals(3) = solve(temp, y);
plot(x_vals, y_vals, 'o', 'Color', 'Red');
equation1 = subs(f_sin, [x y], [x_vals(1) y_vals(1)]);
equation2 = subs(f_sin, [x y], [x_vals(2) y_vals(2)]);
equation3 = subs(f_sin, [x y], [x_vals(3) y_vals(3)]);
pretty(equation1);
pretty(equation2);
pretty(equation3);