Answered
3 d graph, but it's x vs. z and y vs. z
To plot along the plane of 0 in one of the coordinates, just use 0 when plotting. t = 0:720; z = zeros(size(t)); s = sind(t);...

2 years ago | 1

| accepted

Answered
Generate a matrix with alternative positive and negative values with ones
Another approach: r = 4; c = 5; A = (-1).^((1:r).' + (1:c))

2 years ago | 0

Answered
Why is my maxperf.m code not operating correctly
Move the lines where you define p and q and call maxperf out of the maxperf function. With those lines present, MATLAB will do o...

2 years ago | 0

Answered
Plot function suddenly not working (getting error: Index in position 1 is invalid. Array indices must be positive integers or logical values.) Even for MATLAB examples
The correct command to check whether or not you've created a variable named plot is the following: which -all plot You had the...

2 years ago | 1

Answered
transform an empty matrix '0x0 double' into a matrix '0x2 double'
Since a 0-by-0 array and a 0-by-2 array have the same number of elements you can reshape one into the other. A = zeros(0, 0) B...

2 years ago | 1

Answered
creating combinations for different data type
If you're using release R2023a or later use the combinations function. T = combinations([8, 20], ["Age", "Gender"])

2 years ago | 0

Answered
Weird behavior regarding pi in symbolic expressions
See the description of the flag input argument on the documentation page for the sym function. The default method to convert a n...

2 years ago | 0

Answered
Can graphs in Matlab provide a more detailed scale?
Let's look at the data you used to create your first graph as I suspect the insights we gain from that will apply to the others ...

2 years ago | 0

| accepted

Answered
unable to use statistics and machine learning toolbox block in Simulink
You're using this block. From that documentation page: "Import a trained regression object into the block by specifying the name...

2 years ago | 0

Answered
Save and close incrementing open figures
Don't use findobj. When you create a figure, store its handle. When you want to close a figure, use the stored handle. listOfFi...

2 years ago | 0

| accepted

Answered
I do not understand why code will not run when using varargin and am receiving too many inputs error.
You're calling your Newton Raphson function like: [root(j), ep(j), n(j)] = NewtonRaphson(@(x) func(x, e, l, i, w(j)),@(x) d...

2 years ago | 0

| accepted

Answered
Why are symbolic expressions not exactly symbolic?
Run that command in the Live Editor. [Note that I can get the same display running the code in MATLAB Answers: the functionality...

2 years ago | 1

| accepted

Answered
Updating States in ODE45
That documentation page refers to a different meaning of the term "event" in MATLAB, one unrelated to events in differential equ...

2 years ago | 0

| accepted

Answered
Matlab 2020b Update 6 creating dig folder
I believe this is Bug Report 2419782 which indicates it is fixed in the general release of R2022a and in updates for several oth...

2 years ago | 0

Answered
Error using cd Cannot CD to C:\Users\Product\Control\support (Name is nonexistent or not a directory).
I think, the directory path is right but still getting error. I would double check that the directory to which you're trying to...

2 years ago | 0

Answered
How can I import workspace arguments into a function without saving them?
I would like to create a function that directly uses arguments from the workspace without the need to save and reload the worksp...

2 years ago | 0

| accepted

Answered
Going back in time 1 week or a year
Subtract the appropriate calendar duration. t = datetime('today') oneWeekAgo = t - calweeks(1) oneYearAgo = t - calyears(1) ...

2 years ago | 1

Answered
What are the Pros and Cons of the RandStream Transformation Algorithms?
Here's a post from Cleve Moler's blog discussing Ziggurat. Section 9.3 of the chapter on Random Numbers in Cleve's book Numeric...

2 years ago | 0

Answered
How do I implement installation of the NI-DAQmx support package in a compiled application?
Based on this page and given what you said in your first bullet, that the support package isn't listed in Application Compiler, ...

2 years ago | 0

Answered
how can I increase the performance of this loop?
nPts = 15; a = linspace(0.1, 2.0, nPts); b = linspace(0.1, 2.0, nPts); c = linspace(0.1, 2.0, nPts); d = linspace(-0.3, 2.0,...

2 years ago | 0

| accepted

Answered
missing decima using 'datetime' function
No, there's no mistake, but there is a piece missing. Specifying the InputFormat when you construct a datetime only controls how...

2 years ago | 1

| accepted

Answered
How to plot y-axis limits and y-limitation line
If you want to ensure that MATLAB creates ticks and tick labels at particular values, I would use a combination of the xticks or...

2 years ago | 1

Answered
Command for picking two regular elements from a Vector
Use randperm to create shuffled indices then use that index vector to reorder your vector of data. I'll use a deck of cards: va...

2 years ago | 0

Answered
Plotting using given coordinates
Are all the nodes the same distance from the center of your hexagon at (0, 0)? Nodes_stacked = [ 6.3480 3.6650; 0 ...

2 years ago | 1

Answered
Trouble with matlab::data::Array
Have you seen the first of the Topics on this documentation page, which I believe is a "basic explanation" of the C++ MATLAB Dat...

2 years ago | 0

Answered
How matlab distributes the nodes of a graph?
The documentation page for the layout function includes a brief description of each of the layout methods in the section on the ...

2 years ago | 1

Answered
Matlab 2023a slow down
I don't see anything scanning the Bug Reports for Simulink in release R2023a that sounds related to the performance regression a...

2 years ago | 0

Answered
Simple blockchain V2V Communication
You cannot store your % Test the blockchain code in the file after the end that closes the classdef block. If MATLAB hadn't thro...

2 years ago | 1

| accepted

Answered
RGB triple of color name, version 2 does not work with Matlab2023
In MATLAB Online, open the Add-Ons Explorer (the icon that looks like three cubes in the Environment section of the Home tab of ...

2 years ago | 0

| accepted

Answered
Finding a set of easily distinguishable local minima quickly and algorithmically.
Have you tried the islocalmin function?

2 years ago | 0

Load more