Solved


The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

5 years ago

Solved


Area of an equilateral triangle
Calculate the area of an equilateral triangle of side x. <<https://i.imgur.com/jlZDHhq.png>> Image courtesy of <http://up...

5 years ago

Solved


Length of a short side
Calculate the length of the short side, a, of a right-angled triangle with hypotenuse of length c, and other short side of lengt...

5 years ago

Solved


Check if sorted
Check if sorted. Example: Input x = [1 2 0] Output y is 0

5 years ago

Solved


Simple equation: Annual salary
Given an hourly wage, compute an annual salary by multiplying the wage times 40 and times 50, because salary = wage x 40 hours/w...

5 years ago

Solved


Sort a list of complex numbers based on far they are from the origin.
Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

5 years ago

Answered
linearizing a 2nd order ODE in matlab
Hi, Linearization of the given ODE can be done via Jacobian matrices that need to be derived. Some good appropriate discussi...

5 years ago | 0

| accepted

Answered
Why is pagemtimes slower than just coding up the matrix multiplication?
Hi, There is no need to perform this loop calcs that is just a repeatition: tic %for i = 1:20 %% Electric Field Update...

5 years ago | 0

Answered
How can I create a confusion matrix from a simple fuzzy logic model?
Hi, Here is a nice help documentation by which you can develop *.fis models: https://www.mathworks.com/help/fuzzy/genfis.htm...

5 years ago | 1

| accepted

Answered
Fit Curve to a "C" shape
Just a piecewise interpolation can be done in this case, but not fit model calculation: clearvars x = [1 0 -1 0 1]; y = [-1 -...

5 years ago | 0

Answered
How to save output from equation in for loop into an array
% Range from 0.0 m to 4.00 m using 0.01 m increment t=0.0:0.01:4.00; for ii = 1:numel(t) % Formula for enthalpy from entr...

5 years ago | 0

| accepted

Answered
Two different solutions for one differential equation (population model)
Besides k1, in your derivations, there are some errs. Here are the corrected formulation in your derivation part: c1 = 4; c2 =...

5 years ago | 1

| accepted

Answered
how i want to generate error indices and time domain specification?
Hi, You can easily compute the errors using the followings: ERR= SP-PV; IAE = trapz(T,abs(ERR)); % trapz=numerica...

5 years ago | 0

Answered
running of my m-function is very slow
Hi, From the quick scanned imression of your code, the following two points can be proposed. (1) You are using symbolic math ...

5 years ago | 0

| accepted

Answered
Lagrange Interpolation related problem (plotting a graph)
Hi The answer is simple: plot(x, L(1,:)) OR plot(x, L(2,:)) plot(x, V) or plot(x, P) Or within the loop: ... if i~= j ...

5 years ago | 0

Answered
How to use 'layout' in nexttile to make the legend appear in the sixth position in 6 tiled chart?
Hi, Here is a realtively simple solution via an easy example: A = randi([1, 5], 6); p = bar(A); legend(p(1,6),{'6-th tile'...

5 years ago | 0

Answered
Distance of obstacle from Ego vehicle in Point clouds
Hi Mohammed, This help documentation can provide substantial hints for your exercise: https://www.mathworks.com/help/vision/...

5 years ago | 0

Answered
animate Double Pendulum with solved ODE.
Hi, Here is an updated and corrected code with a different animation procedure: L2 = 20; t = 0:.1:2*pi; double_pendule(t, L1...

5 years ago | 0

| accepted

Answered
compute angles between antennas
Hi, The built in function of matlab to compute the phase angles is angle() It computes the phase angle between real and imag...

5 years ago | 0

Answered
How to set up a function
Hi, There are a few built-in functions of integral in MATLAB, such as int() - symbolic, integral(), quad() - numerical integr...

5 years ago | 0

Answered
NUMERICAL METHODS DISCRETISATION PROBLEM
Hi, You can employ pdepe()

5 years ago | 0

Answered
Streamlines over an airfoil
Hi, Here is a good script to simulate Joukowski airfoil: https://www.mathworks.com/matlabcentral/fileexchange/8870-joukowski-a...

5 years ago | 0

Answered
sinh(ax) plot
Hi, Use this synatx approach: syms x a = [?, ?, ?, ..]; % OR a = input('a = '); V = sinh(a(:)*x); fplot(V, [xmin, xmax...

5 years ago | 0

Answered
removing samples from a timeseries between certain time intervals
Hi Alexander, The answers to you posed questions as follows in the order of your questions: (1) Remove specific timeseries: ...

5 years ago | 0

Answered
How can I get real time value from the Simulink scope plot to use inside the MATLAB function block ?
Hi, if you have employed [To Workspace] block, you can use this syntax within your m-file: OUT = sim('ABC.slx'); % Simuli...

5 years ago | 0

Answered
Help to draw a graph of a function.
Hi, (1) There are some inconsistencies with the initial conditions. As given the formulations can never produce some ripples su...

5 years ago | 1

| accepted

Answered
Printing an error message if jacobi's method, does not converges.
Hi, Here is an easy solution: ... if abs (Z-P) < t % if norm(r) < some tolerance , it is converged break e...

5 years ago | 0

Answered
i need to make space between two bar plot in x axis
Hi, ... bar(diag(n),1); % Change 1 to any other number to make bars closer and more appart ...

5 years ago | 0

Answered
How can I get real time value from the Simulink scope plot to use inside the MATLAB function block ?
Hi, (1) You would need to simulate your simulink model inside your matlab script that can be done with sin() that you have pr...

5 years ago | 0

Answered
How to code pde?
Hi, Here are a couple of good documentation libraries with examples: https://www.mathworks.com/help/matlab/ref/pdepe.html h...

5 years ago | 0

Load more