Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

How can I tell the user what type of graph has been produced from his/her input?

1 vue (au cours des 30 derniers jours)
dunphy
dunphy le 15 Avr 2020
Clôturé : MATLAB Answer Bot le 20 Août 2021
Type of graph such as linear graph, etc.,
Here is my code and I have no idea how to make a program that satisfies my question above. Can anyone help?
n2=input('\nHow many values of time do you have?: '); %The n2 variable represents the number of time [in seconds] to complete a cycle
%and the corresponding frequencies, which the user will enter
for i=1:n2;
disp(' ')
tm(i)=input('Enter the value of your time [in seconds]: '); %The w(i) variable represents the values of the wavelength
disp(' ')
fre(i)=input('Enter the value of your frequencies: '); %The fre(i) variable represents the values of the frequency
nocc=@(tm,fre)tm.*fre; %The nocc variable represents the name of the anonymous function together
%with the list of the arguments
%formula for the Number of Complete Cycles emitted in a certain time interval
results=nocc(tm,fre);
end
fprintf('\nHere are the calculated results:\n');
fprintf('\tTime [in seconds] \t Frequencies \t Number of Completed Cycles\n');
fprintf('\t %2.4f s \t\t %4.4f cycle/s \t %6.0f cycles\n',[tm;fre;results])
time=tm'; %The time variable represents the location for the transposed row vector of the time
freqq=fre'; %The freqq variable represents the location for the transposed row vector of the frequenct
cycle=results'; %The cycle variable represents the location for the transposed row vector
%of the Number of Cycles
%This part is only necessary for making an excel file from the output
T = array2table([time(:),freqq(:),cycle(:)], 'VariableNames', {'Time to complete a Cycle','Frequency','Number of Cycles'});
writetable(T, 'cycles.xls')
plot(tm,fre), xlabel('Frequency'), ylabel('Number of Cycles'),title('Number of Cycles vs Frequency Graph')

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by