Respondida
Newton's Method for a polynomial equation
You need to create function handles for your functions. As written, MATLAB thinks you are trying to evaluate the functions at a...

casi 9 años hace | 0

| aceptada

Respondida
Derivative in function handle
E.g., if you want function handles you could get at them with the symbolic toolbox >> syms x >> f = @(x) x + log(x) f...

casi 9 años hace | 1

Respondida
how to extract another matrix out of a big matrix
v = [420,422,425]; B = A(ismember(A(:,1),v),:);

casi 9 años hace | 1

| aceptada

Respondida
Pick 3 lotto code
Here is the instruction: _"... that generates 3 random numbers 1000000 times ..."_ And here is your code: N=1000000 ...

casi 9 años hace | 0

Respondida
Predict the value of pi through the following program and compare with real pi using 2*[(2*n)^2/((2*n)^2-1)]
Just looking at the terms you are summing: S = S + (2*t)^2 / ((2*t)^2-1) The limit as t -> infinity of the part you are ...

casi 9 años hace | 2

Respondida
A simple "bug" in finding an element in an array using find()?
Not a bug. Just the way floating point arithmetic works. E.g., 0.1 cannot be represented exactly in IEEE double precision, so ...

casi 9 años hace | 0

Respondida
t=a:h:b;
An outline of the loop: s = whatever a = whatever b = whatever h = whatever y = zeros(size(t)); y(1) = s...

casi 9 años hace | 0

Respondida
Undefined function 'eq' for input arguments of type 'cell'.
You could change your test to this if you want an exact match: if isequal(x{i},'Apples') x(i) is a cell, whereas x{i} is...

casi 9 años hace | 0

Respondida
How do I use code in C in matlab?
You could start with the mex doc: <https://www.mathworks.com/help/matlab/call-mex-files-1.html> There are several examples...

casi 9 años hace | 0

| aceptada

Respondida
how to convert a p code to .m file with Matlab student version 2016
p code is encrypted. The author typically uses p code because he/she doesn't want the user to be able to recover the original m...

casi 9 años hace | 1

| aceptada

Respondida
Segmentation fault when recoving data from a C code through Mex programming
I haven't tried to run, or even compile, your code. But based on a very quick visual scan it appears to me that this line: ...

casi 9 años hace | 0

Respondida
Very Difficult MATLAB program I am trying to write.
If you just want to plot a rotated moon phase, here is an approach using the "fill" command. % ang = angle to rotate counte...

casi 9 años hace | 3

Respondida
Return by reference from coder.ceval - access to a C array?
I'm not familiar with what you can do to tweak the Coder, but for sure you can't get at the memory you are trying to in the abov...

casi 9 años hace | 0

Respondida
Is there a way to do signed 16 bit integer math?
_"... In standard C programming ..."_ Well, sort of. Signed integer overflow behavior is not really defined in the C languag...

casi 9 años hace | 1

| aceptada

Respondida
For the second part of the question, I keep on getting the following error. I am assuming this is because I need to somehow create a cell inside the cell corresponding to Out? What would be the simplest way of doing this?
You've still got that j-loop too complicated. Use my outline above. Using your vector=[] approach, it would be: vector ...

casi 9 años hace | 0

| aceptada

Respondida
how to convert The binary number floating point to decimal notation, as example,(1.10101010 * 2^1001 ) is equal to 852
You could start with this FEX submission by Toby Driscoll: https://www.mathworks.com/matlabcentral/fileexchange/25326-ieee-75...

casi 9 años hace | 0

Respondida
Can you write a matlab code that will take a binary floating-point number (1.b1b2b3...bn × 2^k) and display the decimal value of that number? Can you enter the binary significant and binary exponent as character strings?
One approach: % convert double number to binary string and exponent x = some non-negative number [F,E] = log2(x); ...

casi 9 años hace | 0

Respondida
matlab second order nonlinear ode
Since it is a 2nd order ODE, first define a 2-element vector, let's call it y just like the examples in the ode45 doc, that matc...

casi 9 años hace | 1

| aceptada

Respondida
creating matrix w.r.t. rows number of another matrix
E.g., a method using a cell array u = unique(col_row(:,1)); n = numel(u); result = cell(max(u),1); for k=1:n ...

casi 9 años hace | 1

| aceptada

Respondida
how do i use the in-built inv function to calculate a matrix inverse and then calculate A-1A and AA-1.
The comment character % needs to be at the beginning of the comments. So these lines Inverse = %calculate the inverse of a ...

casi 9 años hace | 0

Respondida
am calling a print function: cdata=print(filetosave,'-djpeg','-r0'); which succeeds in writing the file but then throws an error: One or more output arguments not assigned during call to "varargout". Perhaps you can help?
According to the doc here: https://www.mathworks.com/help/matlab/ref/print.html?s_tid=doc_ta The only form of calling prin...

casi 9 años hace | 0

| aceptada

Respondida
Place zero in an empty matrix within cell array?
x(emptyCells) = {-1};

casi 9 años hace | 0

| aceptada

Respondida
Can Matlab Factorial a Large Number?
You could use one of these FEX submissions by John D'Errico: https://www.mathworks.com/matlabcentral/fileexchange/22725-varia...

casi 9 años hace | 0

| aceptada

Respondida
Issue: Matrix Dimensions Must Agree
Use element-wise operator ./ (with the dot) instead of the matrix operator / E.g., Volume1=n*R*T1./P; Volume2=n*R*T2...

casi 9 años hace | 0

Respondida
How to keep only 1st row of every 450 rows of data
x = your full data imported from Excel result = x(1:450:end,:); Subset every 450 rows starting with the first

casi 9 años hace | 0

| aceptada

Respondida
How do I multiply multidimensional array by a vector?
First, whenever you are working with multi-dimensional matrices and need to access 2D slices of them for matrix manipulation, it...

casi 9 años hace | 0

Respondida
Randperm a completely different set of numbers each loop
If you mean the numbers can be the same but have to be in different spots, I suppose you could rotate the matching numbers to ge...

casi 9 años hace | 0

Respondida
Calling Konstants from string with name instead of index
Are you just trying to do this? [M_sig,epsopen,Emod,sigopen] = deal(A(1),A(2),A(3),A(4));

casi 9 años hace | 0

Respondida
Creating a function that solves the kepler equation
Your kepler function should output E given the values of e and M. So it should look like this in a file called kepler.m fu...

casi 9 años hace | 0

Cargar más