So I have an electrical signal that is given in this form
I'm trying to execute this script in MATLAB to show it visually
function u=sign_sd(t)
u = [-0.5*t*10e6 * t((t>=0)&(t<=2e-6)),...
-cos[(pi*10e6*(t-2*10e-6))] * t((t>2)&(t<=4e-6)),...
1 * t((t>4)&(t<=6e-6)),...
0 * t((t>6)&(t<=8e-6)),...
0 * t(t>8e-6)];
.
t=0:1e6:10e6;
u=sign_sd(t);
plot(t,u),grid on
But any way I try to change it, it gives an error.
Error: File: sign_sd.m Line: 5 Column: 9
Unbalanced or unexpected parenthesis or bracket.
Error in sign_g (line 3)
u=sign_sd(t);
.
size(t) = 1 11
size(u) = 1 21
Currently besides unbalanced matrix dimensions problem there are unbalanced brackets. Possibly where -cos starts. Can any give an advice on how to fix it, so it works? I've also tried to use zeros(size(t)) in '% signal graph' code, but that didn't solve it.
1 Comment
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/416874-matrix-dimensions-and-unbalanced-bracket-problem#comment_604910
Direct link to this comment
https://la.mathworks.com/matlabcentral/answers/416874-matrix-dimensions-and-unbalanced-bracket-problem#comment_604910
Sign in to comment.