My graph is blank.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
James Robert Miller
am 18 Nov. 2016
Bearbeitet: Walter Roberson
am 21 Nov. 2016
When I run the code I get an answer, but the plot always comes up blank, with a scale that does not match the output of the function.
clear
clc
k = 1:10
x = 0.1:0.1:1
bug = 0
for a = 1 : length(k)
this_k = k(a)
this_x = x(1:a)
bug = bug + sin((factorial(k).^2).*x)/factorial(k)
end
1 Kommentar
James Tursa
am 18 Nov. 2016
Bearbeitet: James Tursa
am 19 Nov. 2016
What plot? I don't see what you are trying to plot. And what is this code supposed to be calculating?
Akzeptierte Antwort
Preethi
am 21 Nov. 2016
Bearbeitet: Walter Roberson
am 21 Nov. 2016
hi,
variable bug is not a vector its a scalar value so when you plot you try to plot the graph is blank.
initialize bug as array with zeros and then use in loop
bug =[bug,bug(a-1)+sin((factorial(k).^2).*x)/factorial(k)]
start for loop index from 2
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Line Plots 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!