receiving error when code is correct on matlab onramp Project - Stellar Motion II task 4?
Mostrar comentarios más antiguos
my code:
for v = 1:7
s = spectra(:,v);
if speed(v)<= 0
plot(lambda,s,"--")
else
plot(lambda,s,"--","LineWidth",3)
end
hold on
end
hold off
It says incorrect for "Did you make a plot with seven line?" and I did? How can I fix this?
1 comentario
Umair
el 27 de Nov. de 2022
same problem
Respuestas (5)
Devaraj Malladad
el 8 de Nov. de 2023
i used below code got result all Pass
if not working, do multiple times of run and logout and login the cource . it amy work
for v = 1:7
s = spectra(:,v);
1<=1
if speed(v) <=0
plot(lambda,s,"--")
end
hold on
end
Abhishek Chakram
el 20 de Jun. de 2022
Editada: Abhishek Chakram
el 20 de Jun. de 2022
Hi Alyssa,
I understand that you are facing issue in completing the Project - Steller Motion II, task 4.
To my understanding, in the 4th task you are just required to plot graph with LineWidth 3, you need not to specify the type of line (here, dashed line)
You can refer to the following code:
for v = 1:7
s = spectra(:,v);
if speed(v) <= 0
plot(lambda,s,'--');
else
plot(lambda,s,'LineWidth',3);
end
hold on;
end
hold off;
3 comentarios
Umair
el 27 de Nov. de 2022
this dosent fix the problem
Sai Krishna Kiriti
el 9 de En. de 2024
I t says in incorrect
David
el 26 de Feb. de 2024
I'm currently facing similar problem. Were you able to solve it?
Mohammed amine
el 18 de Nov. de 2023
0 votos
EXERCICE
Modifiez la ligne 2 du script. Supprimez (:,2) pour calculer la vitesse de toutes les étoiles.
2 comentarios
Mohammed amine
el 18 de Nov. de 2023
Projet finalProjet - Mouvement stellaire II tasks 2-4
Ismail
el 24 de En. de 2025
s = spectra(:,2)
[sHa,idx] = min(spectra)
lambdaHa = lambda(idx)
z = (lambdaHa/656.28) - 1
speed = z*299792.458
I cannot go further beyond this point. Many thanks.
Use the code snippet below in [Task 2-4]
for c = 1:7
s = spectra(:,c);
if speed(c) <= 0
loglog(lambda, s, "--")
else
loglog(lambda, s, "LineWidth", 3)
end
hold on
end
hold off
xlabel('Wavelength') % Adding label for x-axis
ylabel('Intensity') % Adding label for y-axis
Prachi
el 9 de Dic. de 2024
for v= 1:7
s = spectra(:,v);
if speed(v) <=0
plot(lambda,s,"--")
else
plot(lambda,s,LineWidth=3)
end
hold on
end
hold off
Categorías
Más información sobre Marine and Underwater Vehicles en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!