All Questions
146 questions
1
vote
1
answer
209
views
Mismatch between Matlab log and Numpy np.log
While rewriting an old Matlab code to NumPy, I noticed differences in logarithmic calculation.
In NumPy, I use np.log, Matlab uses log function.
b = [1 1 2 3 5 1 1];
p = b ./ sum(b);
sprintf('log(%....
2
votes
1
answer
117
views
MATLAB gives more precision than expected when approximating pi
I am using 2021b. I wanted to look at the convergence rate of a iteration algorithm for Pi, using continued fraction. The formula was for wikipedia https://en.wikipedia.org/wiki/Pi#Continued_fractions....
2
votes
3
answers
133
views
Matlab produces different matrix product results depending on computation form
In Matlab, I compute a rotation of a collection of 2D points in two ways: one by a regular matrix-matrix product, and the other by iterative vector-matrix products, as follows.
>> points = % ...
0
votes
1
answer
152
views
Why I am getting Empty sym problem while solving the problem?
I want p as a function of x after solving this equation. I am unable to get a satisfoctory answer for this.
I am trying to get p as a function of x in MATLAB...bit, am getting an empty sym problem. ...
0
votes
1
answer
54
views
What is a Mat-lab function for « If-in »?
Problem statement: Provide a function that does the following: c1) two vectors D1 and D2 have 7 elements each, then form the division between the corresponding components of each vector and assign the ...
1
vote
2
answers
126
views
Where did i do wrong when i tried to approximatee this data using polynomial?
I am starting to learn numerical analysis using MATLAB in my course. so far we have covered polynomial interpolation (spline, polyfit, constraint spline, etc.) I was doing this practice question and I ...
1
vote
1
answer
200
views
MATLAB - how do I increase the number of datapoints in the graphical display of the numerical solution of a Nyquistplot
I wrote this 'code' for MATLAB:
close all; clear all;
G=zpk([],[-0.1 -1 -1],[1])
nyquist(G)
hold on;
H=zpk([],[-0.1 -1 -1],[2])
nyquist(H)
J=zpk([],[-0.1 -1 -1],[4])
nyquist(J)
And I would like to ...
0
votes
0
answers
154
views
Bessel function integral
I try to compute the integral of the Bessel function with MATLAB but the result is not correct
syms x a
int(besselj(1,a*x)*x^2,0,1)
The result is
(2*besselj(1, a))/a^2 - besselj(0, a)/a
I expected ...
-1
votes
1
answer
227
views
Applying runge kutta for coupled equations
so I have 2 second order nonlinear ODE and after applying the state-space theorm I have 4 first order ODE.
I'm trying to apply RK4 but I think I'm doing it wrong because the graphs diverge.
I'm ...
3
votes
1
answer
110
views
Strange numerical error when transposing a matrix and solving a linear system in Matlab
I stumbled upon rather strange behaviour in MATLAB. The operator for solving a system of linear equations, \, sometimes produces different results, though the only thing that is changed is the place ...
0
votes
1
answer
129
views
Problem on numerical solution of y'=y^2+1
I would like to use numerical approach to calculate the differential with singularities.
For instance, y'=y^2+1 with y(0)=0. The analytical solution is not hard to find, y=tan(x).
The problem arises ...
0
votes
1
answer
76
views
numerical problem after iterations in Matlab
I encountered some numerical questions when running simulation on MatLab. Here please find the questions:
I found that A*A' (a matrix times its transpose) is not guaranteed to be symmetric in MatLab....
0
votes
1
answer
61
views
Averages of table with numeric and non numeric data (Matlab)
Hi I'm fairly new to coding (Matlab) and was wondering if anyone knew how to do this. I have a table with numeric data with some non numeric data throughout it. I want to go through the table data and ...
0
votes
1
answer
201
views
Matlab/Octave bitget function for any base
Need function like bitget, but for any base.
Would be nice to have as well:
array input and array bit selection
anonymous function
0
votes
2
answers
313
views
dec2base with independent bits/digits calculation
Need MATLAB/Octave dec2base functionality function with independent bits/digits calculation algorithm (within integer logic, with no divisions, using modular arithmetic).
Would be nice to have as well:...