Hello, I am currently familiarizing myself with MATLAB for my research. I was asked to create a program that reads in two vectors from the user and then graph them. I am currently having difficulty correctly performing the the addition and multiplication of these vectors. I am new to this website and MATLAB as a whole. I was hoping someone could assist me in any way.
Thank you, first and foremost for your support. I have spent the last couple of days researching operation techniques and I have come up with the following code for each different function (all of function data may not be included)
for addition:
a = get(handles.textvector1,'String'); b = get(handles.textvector2,'String'); %if length is the same
if length(a) == length(b) %add vectors
c = a + b; %set text to result
set(handles.textvectorresult,'String',c); %plot result
plot(c) % or display error message
else errordlg('Please enter vectors of same size','Size mismatch error','modal') end and for multiplication:a = get(handles.textvector1,'String');b = get(handles.textvector2,'String');%if length is the sameif length(a) == length(b)%add vectors c = a .* b;%set text to resultset(handles.textvectorresult,'String',c);%plot resultplot(c)% or display error messageelse errordlg('Please enter vectors of same size','Size mismatch error','modal')end I end up getting unusually high numbers
Thanks, Prince Njoku
Best Answer