Answered
Corrupted .m file after save function in script?
It is currently in a MATLAB® formatted binary file. You _probably_ have to *|load|* it back into your workspace. That may rest...

8 years ago | 0

Answered
How do I specify parameters to send to my ODE function when calling it using ode45?
This works: function [xdot] = RVorbitPropogation(t, x, mu) r = sqrt((x(1))^2 + (x(2))^2 + (x(3))^2); %Define R xdot ...

8 years ago | 1

| accepted

Answered
Why am I getting this error "Operands to the || and && operators must be convertible to logical scalar values."
Delete the *|'s'|* from the temperature *|input|*. You want a number, not a string. T = input('Enter temperature(K) to c...

8 years ago | 1

| accepted

Answered
Why am I getting this error? The code works to solve the equation in terms of a and b for my teacher in class, but my professor is not having the issue. It solves for her.
Lose the single quotes and it will solve for you, too: syms a b x B = solve(a*x^2 + b*x, b) B = -a*x ...

8 years ago | 1

Answered
How to get a statistically significant mean from multiple matrices?
What you do with respect to statistical analysis depends on how you designed your study. (Ideally, this consideration was part ...

8 years ago | 0

| accepted

Answered
Why does the distributive property fail when comparing expressions?
To get logical results with symbolic expressions, use the <https://www.mathworks.com/help/symbolic/isalways.html *|isAlways|*> (...

8 years ago | 0

Answered
What's the difference between sound and sounsc?
The documentation is clear: * |sound(y)| sends audio signal |y| to the speaker at the default sample rate of 8192 hertz. * ...

8 years ago | 1

Answered
How to extract a vector from a matrix with indices?
Create a linear index with *|sub2ind|*, and use it to get the elements you want: M = randi(99, 3, 2) ...

8 years ago | 2

Answered
How to store solutions of roots-function inside matrix?
The easiest way is simply to save it as a cell array: findsolutionsxvalues{i} = [roots([a b c d e -x(i)]);]% set each x(i)...

8 years ago | 0

| accepted

Answered
Replacing a value with nan
Try this: RTc = [1 2 3 NaN; 4 5 6 7; NaN 8 9 10] % Create Matrix AccuracyC = randi(9, size(RTc)) ...

8 years ago | 0

| accepted

Answered
Why am I getting this error?
With the *|pHo->pHi|* change, and removing the the quotes from and adding the ‘double equal’ to these lines: E1= Kap==Vblo...

8 years ago | 0

| accepted

Answered
How to add Multiple reference lines in single MatLab plot
Add this line just after your *|‘Impact_Energy’|* vector assignment: T70 = interp1(Temp, Impact_Energy, [-70; 70]); and ...

8 years ago | 0

| accepted

Answered
How to restrict the angle a cylinder is defined over
Another option: [x,y,z]=cylinder([0,7,7,0],100); cidx = 1:ceil(size(x,2)*(pi/(2*pi))); % Scale Column...

8 years ago | 0

Answered
Line Marker in PLOT
There are several <https://www.mathworks.com/matlabcentral/fileexchange/?utf8=%E2%9C%93&term=plot+marker *File Exchange plot mar...

8 years ago | 0

Answered
Trying to plot error
You never change *|‘epsilon’|* in your code, so it remains a single scalar value. You need to create a vector from it if you wa...

8 years ago | 0

Answered
How to change the centre of one face of a cone
Try this: a = linspace(0, 2*pi); ra = 1; rb = 5; apex = [rb*cos(a); ra*cos(a)]; base = [rb*sin(a)+rb; ra*sin(a...

8 years ago | 1

| accepted

Answered
plotting a matrix( polynomial order )
Use the *|polyval|* function: A1 = [2 5 8;-3 4 6]; A2 = [4 2;3 5]; x = linspace(-5, 5); ...

8 years ago | 0

| accepted

Answered
when I run script it doesn't read my "R" or "V" variables it reads as is
Invoking the Symbolic Math Toolbox first, with the *|syms|* call, helps significantluy: syms i1 i2 i3 v1 v2 v3 R1=5; ...

8 years ago | 1

| accepted

Answered
Can't plot output of inverse laplace function
Try this: i16= vpa(ilaplace(I16)) fplot(i16, [0 5]) Substitute those *|2|* lines for the last *|3|* lines of the cod...

8 years ago | 1

| accepted

Answered
Dynamic XTickLabel value based on number of data points and frequency
Try this: Fs1 = 1000; % Upper Trace t1 = linspace(0, 32768/Fs1, 32768); ...

8 years ago | 0

| accepted

Answered
Error in discrete-time transfer function bode plot
There is nothing wrong. The upper plot begins at *|1E-3|* r/s, and the lower plot begins at *|1E-2|* r/s. If you want them...

8 years ago | 0

Answered
program repeat the highest value each time I run it
Your code runs correctly, as far as I can determine. If the original *|‘N’|* is less than or equal to *|128|*, the *|else|*...

8 years ago | 0

| accepted

Answered
fprintf problem, can't print
Since *|‘DateTimeStr’|* is likely an character array, you have to address it as such in the variable reference to it: fpri...

8 years ago | 1

Answered
Opposite of Interpolation: reduce size from a very detailed 2D matrix to a less detailed 2D matrix
You can always interpolate to a coarser grid than the original data. This uses *|interp1|* for simplicity. The same idea w...

8 years ago | 0

Answered
getting string from cell using if statement
The best way to compare strings is to use the <https://www.mathworks.com/help/matlab/ref/strcmp.html *|strcmp|*> (link) or relat...

8 years ago | 0

Answered
How can I create a ylabel with an hbar (i.e. h/2pi)?
You left out the beginning and ending *|$|*'s. Try this: ylabel('$\hbar\omega (meV)$', 'Interpreter', 'latex')

8 years ago | 1

| accepted

Answered
How can i add all the points between two data cursor points
Using the <https://www.mathworks.com/help/matlab/ref/sum.html *|sum|*> (link) function on the appropriate vector should work. I...

8 years ago | 0

Answered
How to change the value of a repeated scalar within a column
See if this does what you want: D = randi([20 80], 25, 1); % Create Vector n =...

8 years ago | 0

Answered
All possible pairs in a vector
Try this: A = [1 2 3 4 5]; Out = nchoosek(A, 2) Out = 1 2 1 3 1 4 1 ...

8 years ago | 3

| accepted

Load more