Splitting code into groups

2 visualizaciones (últimos 30 días)
Jesse White
Jesse White el 18 de Mayo de 2021
Respondida: Stephan el 18 de Mayo de 2021
Hello, I'm doing an assignment for class and I need to submit multiple equations and their answers solved by matlab in a single .m file. Right now the only way i've figured out how to do this is to break the code into sections using %% and then running each individual section. I dont want to have to do this, I just want it so when I run the code it gives me all the answers to all the questions. Thank you
clc
%% Q1
a=sin(2.1)*cos(0.9)^2;
b=log10(39);
V=a/b
%% Q2
syms h
f=inline('1/x','x');
limit(f(x),x,inf)
%% Q3
f=inline('1/x-1','x');
syms x
limit(f(x),x,inf, 'left')
%% Q4
f=inline('1/x','x');
syms x
limit(f(x),x,0,'right')
%% Q5
syms x
f=inline('(2*x^7-x^2)*(x-1/x+1)','x');
diff(f(x),x)
%% Q6
syms x
f=inline('log(x)/1+log(x)','x');
diff(f(x),x)
%% Q7
syms x
f=inline('log(sin(x)^2)','x');
diff(f(x),x)
%% Q8
syms x
f=inline('exp(x*tan(x))','x');
diff(f(x),x)
%% Q9
syms x
f=inline('sin(x)+cos(x)','x');
diff(f(x),x,2)
%% Q10
a = [6 1 0 4 -3; -9 2 3 -8 1; 7 0 -4 5 2]
R=rref(a)
%% Q11
a=[3 5 -2 6; 1 2 -1 1; 2 4 1 5; 3 7 5 3];
det(a)
inv(a)

Respuestas (1)

Stephan
Stephan el 18 de Mayo de 2021
Note that the run button will run all your code in one, while the other buttons will run you code section wise and go / go not to the next section:

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by