How can I fix Iapp?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sonuncu Saniye
am 5 Dez. 2017
Beantwortet: Elizabeth Reese
am 7 Dez. 2017
dt=0.002;
N=2;
simstart=10;
simfinish=20;
period=simfinish-simstart;
Io=10;
Iapp = zeros(N,simstart/dt);
Iapp = [Iapp Io*ones(N,1+((period/dt)))];
Iapp = [Iapp zeros(N,(tmax-simfinish)/dt)]
When I set simstart=0.2 and simfinish=0.8 I get the following error: "Error using ones, size inputs must be integers." Thank you for your help!!
0 Kommentare
Akzeptierte Antwort
Elizabeth Reese
am 7 Dez. 2017
This is a floating point issue. You can see this by typing
format long
in the MATLAB Command Window and displaying all of the values you compute in each step. The numbers period and dt look exact but are not, and their division is not exactly 300. This is because some real values are not represented as floating point numbers, so computers round those computations to the nearest floating point number. You can use the round function to ensure that the input to ones is an integer.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!