Plot 2d function not working
古いコメントを表示
I guess I am having a plot issue today. I tried a matlab tutorial from mathworks, did exactly what the instructor did. Plot function errors out and doesn't plot the line of the graph. This is the second time today something hasn't plotted a line. Searched matlab function doesn't draw line and went through many examples and settings. Figured i would try something that was supposed to work and wasn't an issue with my code. https://www.youtube.com/watch?v=OHxR8iMHDWw
%% sin(alpha)= sin(delta)*sin(phi)+cos(delta)*cos(phi)(15(LST-12))
%% Which is the equation for solar pannel production in kW vs time of day.
%% should result in a squared off bell curve.
lat = 42 +17/60 %% log coordinate for Natik in degrees above equator *gamma*
dec = 23.45 %% Solar declination on june 21st
lat = lat*pi/180 %% convert lat to radians
dec = deg2rad(dec) %% convert dec to radians
t = 5.5:0.25:20 %% time of day input from 5:30 am - 8 pm
LST = t - 1 + 14.6/60 %% Converts time and applies a shift
sunangle = sin(dec)*sin(lat)+cos(dec)*cos(lat)*cosd(15*(LST-12));
plot(t,sunangle);
The first problem is I tried to control/ click to select t and sunangle, to plot using the same 2d plot method. It popped up with the plot window,but no line (expected a slightly squared bell curve). But the plot was blank and it failed to add the plot code as it should have. After manually entering the plot (t,sunangle) it failed with the fault below.
Error in Solar (line 19)
plot(t,sunangle)
採用された回答
その他の回答 (1 件)
カテゴリ
ヘルプ センター および File Exchange で 2-D and 3-D Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
