Cody

Problem 44948. Calculate a Damped Sinusoid

Solution 2142110

Submitted on 27 Feb 2020 by karthik raj
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
y_correct = [1.0000 0.7246 0.1554 -0.4232 -0.7524 -0.7118 -0.3583 0.1177 0.4912 0.6065]; y_test = damped_cos(0.5, 1, 10); assert( all ( abs(y_correct(:) - y_test(:)) < 1e-4 ) )

y = [] t = 0 0.1111 0.2222 0.3333 0.4444 0.5556 0.6667 0.7778 0.8889 1.0000 y1 = 1 y = 1 y1 = 0.7246 y = 1.0000 0.7246 y1 = 0.1554 y = 1.0000 0.7246 0.1554 y1 = -0.4232 y = 1.0000 0.7246 0.1554 -0.4232 y1 = -0.7524 y = 1.0000 0.7246 0.1554 -0.4232 -0.7524 y1 = -0.7118 y = 1.0000 0.7246 0.1554 -0.4232 -0.7524 -0.7118 y1 = -0.3583 y = 1.0000 0.7246 0.1554 -0.4232 -0.7524 -0.7118 -0.3583 y1 = 0.1177 y = 1.0000 0.7246 0.1554 -0.4232 -0.7524 -0.7118 -0.3583 0.1177 y1 = 0.4912 y = 1.0000 0.7246 0.1554 -0.4232 -0.7524 -0.7118 -0.3583 0.1177 0.4912 y1 = 0.6065 y = 1.0000 0.7246 0.1554 -0.4232 -0.7524 -0.7118 -0.3583 0.1177 0.4912 0.6065

2   Pass
y_correct = [1.0000 -3.4903 12.1825]; y_test = damped_cos(-0.5, 5, 3) assert( all ( abs(y_correct(:) - y_test(:)) < 1e-4 ) )

y = [] t = 0 2.5000 5.0000 y1 = 1 y = 1 y1 = -3.4903 y = 1.0000 -3.4903 y1 = 12.1825 y = 1.0000 -3.4903 12.1825 y_test = 1.0000 -3.4903 12.1825