matrix dimensions incompatible problem.

Hey, basic new guy question here, that I feel stupid even asking but I can't seem to find the answer or get my code to work. All I'm trying to do is define a time domain and then have matlab return an x value for each time increment in the time domain, according to a given formula:
t=linspace(0,3);
dampedx =(0.1*cos(10*t)+0.00025*sin(10*t))*exp(-0.0025*t);
The trig function part works, but it is the "exp(-0.0025*t)" term it seems to have an issue with. I tried using "t." instead of "t" because I'm trying to tell it for each value of t, calculate a corresponding value of x, but I think it is trying to do something funky with the entire array of values in t, because it keeps giving me some error about matrix dimensions.

 採用された回答

Walter Roberson
Walter Roberson 2020 年 2 月 10 日

0 投票

Use .* instead of *

その他の回答 (0 件)

カテゴリ

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by