Info
この質問は閉じられています。 編集または回答するには再度開いてください。
How can I tell the user what type of graph has been produced from his/her input?
1 回表示 (過去 30 日間)
古いコメントを表示
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')
0 件のコメント
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!