필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

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

조회 수: 1 (최근 30일)
dunphy
dunphy 2020년 4월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
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개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by