y[n] = 3*2/3^n*cos(pi)
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I want to plot the function above. If i only fill in 3*2/3^n it works and also only cos(pi) works but when i put them in as 3*2/3^n*cos(pi) it doesn't work.
The error:
Error using ^
Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the power is a scalar. To operate on each element of the matrix individually, use POWER (.^) for elementwise power.
Error in Practicum_3_Matlab (line 32)
y8 = 3*2/3^n*cos(pi*n+0);
0 commentaires
Réponses (1)
Praveen Thota
le 28 Déc 2022
Hi,
I understand that you want to plot a custom function but encountering an error message.
Use of element-wise operators for power and division should resolve the issue.
The function should be written like this
>> y = 3*2./3.^n*cos(pi);
0 commentaires
Voir également
Catégories
En savoir plus sur Axes Appearance dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!