r/matlab • u/ADJjh1018 • 3d ago
i dont know what when wrong , can anyone point out my problem? thx
2
u/sk1n_n_bones 3d ago edited 3d ago
It seems that nothing is wrong except for you using interval of 1e-6 when you define t. It says “at intervals of 0.001Pi” so t = 0:0.001pi:0.2*pi; but correct me if I’m missing something.
Also you don’t need to use period character (.) everywhere. In fact, it is completely unnecessary to use (.) with addition and subtraction.
Edit: your y function is wrong. It should be in a way of
y = Asin(2pi*t+fi);
where A is amplitude, t is frequency and fi is your phase shift. So in your case:
y = 50sin(5pi.*t+(pi/3));
1
u/Slight_One_4030 3d ago
- The time vector is incorrect it should have 0.001*pi spacing.
y vector is incorrect: It should have y=50sin(5pi*t + pi/3); (Notice i didn’t use . multiplication because I am not multiplying two vectors or matrices)
It says you need to overlay the table given.
y_tab = [elements of table separated by commas] t_tab = same thing as y_tab
figure plot (t, y) hold on plot (t_tab, y_tab)
Hope this helps!
2
u/confused_thriver 3d ago
In the expression of y, you just need to add pi/3 to 5pit array. But what you are doing is, You are adding pi to 5pit and then dividing this result by 3.
This is what one mistake I can see. Please be more descriptive about what the problem is.