Array indices must be positive integers or logical values.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clear
close all
clc
t=[0:0.1:5];
M=2;
E=25;
B=(sin(M*pi.*t));
SC=E(1+exp(-t/4).*(sin(M*pi.*t)));
I'm trying to run this equations, but i'm getting an error that I don't understand.
Array indices must be positive integers or logical values.
0 commentaires
Réponses (1)
Geoff Hayes
le 10 Avr 2019
demoria - your E is a scalar (25) but you are treating it like an array at
SC=E(1+exp(-t/4).*(sin(M*pi.*t)));
and so the error message makes sense. Perhaps you need an operation (for example multiplication) here instead
SC = E * (1+exp(-t/4).*(sin(M*pi.*t)));
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!