Why do I get Error: File: exercise_1_b.m Line: 8 Column: 28 Unexpected MATLAB operator.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Porgs
am 31 Mär. 2018
Beantwortet: Ahmet Cecen
am 31 Mär. 2018
I get this error
Error: File: exercise_1_b.m Line: 8 Column: 28
Unexpected MATLAB operator.
this is my code
t = [-2.5: 0.01: -1.5];
A_c = 1;
f_c = 50;
m_t = sinc(2 * (t - 2)) - sinc(2 * (t + 2));
% b)
k_a = input('enter the value of k_a: ');
s_t = A_c * (1 + k_a * m_t). * cos(2 * pi * f_c * t);
plot(t, s_t);
If I dont use the "." operator for "s_t".
I get the
Error using *
Inner matrix dimensions must agree."
error.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 31 Mär. 2018
Do not have a space between the . and the * . It is a pair of characters that must go together, .*
0 Kommentare
Weitere Antworten (1)
Ahmet Cecen
am 31 Mär. 2018
s_t = A_c * (1 + k_a * m_t) .* cos(2 * pi * f_c * t);
The operator is ".*" not ". *". That being said there are still other issues here, starting with sinc not being a function.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!