A=[1 2 3; 4 5 6; 9 8 6]
A=[1 2 3; 4 5 6; 9 8 6];
A(2,1)
A(2,2)
A(2,1:2)
A(1:2,2:3)
A(1:2,:)
size(A)
A'
inv(A)
A*inv(A)
sum(A) % summerer kolonner
sum(A')
zeros(3,2)
B=ones(3,2)
B*B'
B.*B
b=1:10;
c=ones(size(b))
c=ones(1,10)
sum(b) %don't use loops if you can avoid it!!!
b*c'
a=0:0.01:2*pi;
plot(a,sin(a))
hold on
plot(a,cos(a),'r')
b=linspace(0,2*pi,10);
plot(b,cos(b),'ro')
hold off
axis tight
%dock figur
%ordne vinduer
%kopier Command History -> Editor
help rand
a=rand(1,1000);
plot(a,'o')
figure
b=randn(1,1000);
plot(b,'o')
hist(b)
figure(1)
hist(a)
x=0:100;
y=3*x+5;
plot(x,y,'s')
%%
figure(1)
y=3*x+5+20*randn(size(x));
plot(x,y,'s')
plot(x,y)
plot(x,y,'s')
help polyfit
[p,s]=polyfit(x,y,1) %ikke nøyaktig 3 og 5
hold on, plot(x,y,'k:','LineWidth',2), hold off
xlabel('Strøm, mA','FontSize',20,'FontName','Times')
ylabel('Spenning, mV','FontSize',20,'FontName','Times')
text(10,280,['R = U/I = ',num2str(p(1),3),' Ohm'],'FontSize',20,'FontName','Times')
set(gca,'FontName','Times')
set(gca,'FontSize',20)
axis tight
%Store nok fonter!
%Data markert med punkter, ikke linjer mellom punktene
%Modelltilpasning til data markert med tydelig linje