Array indices must be positive integers or logical values.
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Geoff Hayes
on 10 Apr 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 Comments
See Also
Categories
Find more on Logical in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!