Cody

Problem 44948. Calculate a Damped Sinusoid

Solution 3000880

Submitted on 28 Sep 2020 at 8:12
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   Fail
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 ) )

Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'. Error in damped_cos (line 3) y=cos(2*pi*t)*exp(-lambda*t); Error in Test1 (line 2) y_test = damped_cos(0.5, 1, 10);

2   Fail
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 ) )

Error using * Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'. Error in damped_cos (line 3) y=cos(2*pi*t)*exp(-lambda*t); Error in Test2 (line 2) y_test = damped_cos(-0.5, 5, 3)

Suggested Problems

More from this Author13

Community Treasure Hunt

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

Start Hunting!