receiving error when code is correct on matlab onramp Project - Stellar Motion II task 4?
    24 ビュー (過去 30 日間)
  
       古いコメントを表示
    
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?
回答 (5 件)
  Devaraj Malladad
 2023 年 11 月 8 日
        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
0 件のコメント
  Abhishek Chakram
      
 2022 年 6 月 20 日
        
      編集済み: Abhishek Chakram
      
 2022 年 6 月 20 日
  
      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 件のコメント
  Mohammed amine
 2023 年 11 月 18 日
        EXERCICE
Modifiez la ligne 2 du script. Supprimez (:,2) pour calculer la vitesse de toutes les étoiles.
2 件のコメント
  Ismail
 2025 年 1 月 24 日
				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.
  David
 2024 年 2 月 26 日
        
      編集済み: David
 2024 年 2 月 26 日
  
      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
0 件のコメント
  Prachi
 2024 年 12 月 9 日
        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
0 件のコメント
参考
カテゴリ
				Help Center および File Exchange で Marine and Underwater Vehicles についてさらに検索
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!