MATLAB Answers

Symbols instead of line with plot

6 views (last 30 days)
cris sanchez
cris sanchez on 3 Jul 2020
Commented: Walter Roberson on 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
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;
yyaxis left
hold on
plot(T,k,'kx', 'LineWidth',2)
yyaxis right
hold on
plot(T,Cp,'kx', 'LineWidth',2)

  1 Comment

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

Sign in to comment.

Answers (1)

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

  1 Comment

Walter Roberson
Walter Roberson on 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.

Sign in to comment.