working with input argument of a function
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
i have table with 2 columns , the input are functions and Time intervals , in which each function must be plotted .
i want to create a variable , that is equal to the end value of the before last function . for example the function f1 ended at the time t_end , this variable should be m=f1(t_end) . in order to be able to use it in the body of the next function ( f2= f1(t_end)+...) if i want .
the problem ist how to get this variable as an input argument , the whole code look like that
MTablecurrentdata=get(handles.Mtable,'data');
Momentdata=MTablecurrentdata(:,1);
Timedata=MTablecurrentdata(:,2);
if size(MTablecurrentdata,1)==1
Mi= str2func(['@(t)' Momentdata{1,1}]);
Ti = str2num(Timedata{1,1});
fplot(Mi,Ti,'Parent',handles.axes1);
else
for i=2:size(MTablecurrentdata,1)
Told = str2num(Timedata{i-1,1}); %old time interval
Tnew = str2num(Timedata{i,1}); %new time interval
%t2 end time of the old function [t1 t2]
Endtime=max(str2num(Timedata{i-1,1}));
%t3 start time of the new function [t3 t4]
Starttime=min(str2num(Timedata{i,1}));
Mfuncold= str2func(['@(t)' Momentdata{i-1,1}]);
Mfuncnew= str2func(['@(t)' Momentdata{i,1}]);
fplot(Mfuncold,Told,'Parent',handles.axes1);
hold(handles.axes1,'on')
fplot(Mfuncnew,Tnew,'Parent',handles.axes1);
hold(handles.axes1,'on')
end
hold(handles.axes1, 'off')
end
the input argument m of the function handles must be equal to Mfuncold(Endtime) i tried many ways , but no result .
Respuestas (1)
Walter Roberson
el 16 de En. de 2014
0 votos
1 comentario
Elia
el 17 de En. de 2014
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!