The plot was not out correctly
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi, this is the codes i have for the problem but somehow the plot was not out correctly like the example output.
Please help me identify the mistake, please! TIA!
% TASK 1
Power = input('Enter the power rating of the lamp bulb [W]: ');
Time = input('Enter the time at which to calculate brightness [microseconds]: ');
I = 15 .* Power .* (1 - (1.40.*(exp(1)).^(-Time)) .* sin(1.43.*(Time) + pi./4));
fprintf('The brightness of the %d-Watt lamp will be %3.2f lumens at %d microseconds.\n', Power, I, Time);
% TASK 2
Surge = input('Enter the time the surge starts [microseconds]: ');
I = Brightness(Power, Time, Surge);
Surge = 10 .* Power .* exp(1).*(-1) .* sin(1.43./2);
fprintf('The brightness of the lamp will be %3.2f lumens at\n %d microseconds, after factoring in the power surge.\n', I, Time);
% TASK 3
Time = [0 : 0.01 : Time];
I = Brightness(Power, Time, Surge);
figure(1)
plot(Time, I, 'ro', 'LineWidth', 3);
title('Brightness of Lamp over Time');
xlabel('Time (t) [microseconds]');
ylabel('Brightness (I) [lumens]');
grid on
5 comentarios
Respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!