MATLAB Answers

Symbols instead of line with plot

조회 수: 6(최근 30일)
cris sanchez
cris sanchez 3 Jul 2020
Hi, wanted to know why appears some symbols instead of the line with plot.
This is what I get:
And this is some part of the code:
function temp_Callback(hObject, eventdata, handles)
global s;
% hObject handle to temp (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'Value') returns position of slider
% get(hObject,'Min') and get(hObject,'Max') to determine range of slider
T = get(hObject, 'Value'); %get value from slider
set(handles.text15, 'String', T); %Set the slider's value to the static text
[k,Cp]=proptermicas(T,s); %k y cp are calculated sending as parameters the slider value and the substance
set(handles.edit8, 'String', k); %Set the k to the edit box
set(handles.edit7, 'String', Cp); %Set Cp to the last edit box
cla()
T_ = linspace(-50,400,20); %Declare a new variable with the slider range -50 to 400
for i = 1:20 %for i to linespace 20
[k,Cp]=proptermicas(T_(i),s); %call to the function
k_ = k;
Cp_ = Cp;
end
yyaxis left
cla
plot(T_,k_)
hold on
plot(T,k,'kx', 'LineWidth',2)
yyaxis right
plot(T_,Cp_)
hold on
plot(T,Cp,'kx', 'LineWidth',2)

  댓글 수: 1

Walter Roberson
Walter Roberson 3 Jul 2020
I predict that proptermicas is returning a character such as '^' rather than numbers.

댓글을 달려면 로그인하십시오.

답변(1개)

the cyclist
the cyclist 3 Jul 2020
It looks like it might be because
k_
is only a single value, the last one of the loop. Maybe you wanted
k_(i) = k;
in the loop?

  댓글 수: 1

Walter Roberson
Walter Roberson 3 Jul 2020
Oh, could be... the change in symbols might be due to the "hold on", which I did not pay attention to when I commented.

댓글을 달려면 로그인하십시오.

태그

제품


릴리스

R2019a

Translated by