主要内容

Results for


How to leave feedback on a doc page
Leaving feedback is a two-step process. At the bottom of most pages in the MATLAB documentation is a star rating.
Start by selecting a star that best answers the question. After selecting a star rating, an edit box appears where you can offer specific feedback.
When you press "Submit" you'll see the confirmation dialog below. You cannot go back and edit your content, although you can refresh the page to go through that process again.
Tips on leaving feedback
  • Be productive. The reader should clearly understand what action you'd like to see, what was unclear, what you think needs work, or what areas were really helpful.
  • Positive feedback is also helpful. By nature, feedback often focuses on suggestions for changes but it also helps to know what was clear and what worked well.
  • Point to specific areas of the page. This helps the reader to narrow the focus of the page to the area described by your feedback.
What happens to that feedback?
Before working at MathWorks I often left feedback on documentation pages but I never knew what happens after that. One day in 2021 I shared my speculation on the process:
> That feedback is received by MathWorks Gnomes which are never seen nor heard but visit the MathWorks documentation team at night while they are sleeping and whisper selected suggestions into their ears to manipulate their dreams. Occassionally this causes them to wake up with a Eureka moment that leads to changes in the documentation.
I'd like to let you in on the secret which is much less fanciful. Feedback left in the star rating and edit box are collected and periodically reviewed by the doc writers who look for trends on highly trafficked pages and finer grain feedback on less visited pages. Your feedback is important and often results in improvements.
Oleksandr
Oleksandr
Last activity 2024-5-28

Let's talk about probability theory in Matlab.
Conditions of the problem - how many more letters do I need to write to the sales department to get an answer?
To get closer to the problem, I need to buy a license under a contract. Maybe sometimes there are responsible employees sitting here who will give me an answer.
Thank you
Hello MATLAB Community!
We've had an exciting few weeks filled with insightful discussions, innovative tools, and engaging blog posts from our vibrant community. Here's a highlight of some noteworthy contributions that have sparked interest and inspired us all. Let's dive in!

Interesting Questions

Cindyawati explores the intriguing concept of interrupting continuous data in differential equations to study the effects of drug interventions in disease models. A thought-provoking question that bridges mathematics and medical research.
Pedro delves into the application of Linear Quadratic Regulator (LQR) for error dynamics and setpoint tracking, offering insights into control systems and their real-world implications.

Popular Discussions

Chen Lin shares an engaging interview with Zhaoxu Liu, shedding light on the creative processes behind some of the most innovative MATLAB contest entries of 2023. A must-read for anyone looking for inspiration!
Zhaoxu Liu, also known as slanderer, updates the community with the latest version of the MATLAB Plot Cheat Sheet. This resource is invaluable for anyone looking to enhance their data visualization skills.

From File Exchange

Giorgio introduces a toolbox for frequency estimation, making it simpler for users to import signals directly from the MATLAB workspace. A significant contribution for signal processing enthusiasts.

From the Blogs

Cleve Moler revisits a classic program for predicting future trends based on census data, offering a fascinating glimpse into the evolution of computational forecasting.
With contributions from Dinesh Kavalakuntla, Adam presents an insightful guide on improving app design workflows in MATLAB App Designer, focusing on component swapping and labeling.
We're incredibly proud of the diverse and innovative contributions our community members make every day. Each post, discussion, and tool not only enriches our knowledge but also inspires others to explore and create. Let's continue to support and learn from each other as we advance in our MATLAB journey.
Happy Coding!

In the MATLAB description of the algorithm for Lyapunov exponents, I believe there is ambiguity and misuse.
The lambda(i) in the reference literature signifies the Lyapunov exponent of the entire phase space data after expanding by i time steps, but in the calculation formula provided in the MATLAB help documentation, Y_(i+K) represents the data point at the i-th point in the reconstructed data Y after K steps, and this calculation formula also does not match the calculation code given by MATLAB. I believe there should be some misguidance and misunderstanding here.
According to the symbol regulations in the algorithm description and the MATLAB code, I think the correct formula might be y(i) = 1/dt * 1/N * sum_j( log( ||Y_(j+i) - Y_(j*+i)|| ) )
📚 New Book Announcement: "Image Processing Recipes in MATLAB" 📚
I am delighted to share the release of my latest book, "Image Processing Recipes in MATLAB," co-authored by my dear friend and colleague Gustavo Benvenutti Borba.
This 'cookbook' contains 30 practical recipes for image processing, ranging from foundational techniques to recently published algorithms. It serves as a concise and readable reference for quickly and efficiently deploying image processing pipelines in MATLAB.
Gustavo and I are immensely grateful to the MathWorks Book Program for their support. We also want to thank Randi Slack and her fantastic team at CRC Press for their patience, expertise, and professionalism throughout the process.
___________
David
David
Last activity 2024-5-23

A colleague said that you can search the Help Center using the phrase 'Introduced in' followed by a release version. Such as, 'Introduced in R2022a'. Doing this yeilds search results specific for that release.
Seems pretty handy so I thought I'd share.
Are you local to Boston?
Shape the Future of MATLAB: Join MathWorks' UX Night In-Person!
When: June 25th, 6 to 8 PM
Where: MathWorks Campus in Natick, MA
🌟 Calling All MATLAB Users! Here's your unique chance to influence the next wave of innovations in MATLAB and engineering software. MathWorks invites you to participate in our special after-hours usability studies. Dive deep into the latest MATLAB features, share your valuable feedback, and help us refine our solutions to better meet your needs.
🚀 This Opportunity Is Not to Be Missed:
  • Exclusive Hands-On Experience: Be among the first to explore new MATLAB features and capabilities.
  • Voice Your Expertise: Share your insights and suggestions directly with MathWorks developers.
  • Learn, Discover, and Grow: Expand your MATLAB knowledge and skills through firsthand experience with unreleased features.
  • Network Over Dinner: Enjoy a complimentary dinner with fellow MATLAB enthusiasts and the MathWorks team. It's a perfect opportunity to connect, share experiences, and network after work.
  • Earn Rewards: Participants will not only contribute to the advancement of MATLAB but will also be compensated for their time. Plus, enjoy special MathWorks swag as a token of our appreciation!
👉 Reserve Your Spot Now: Space is limited for these after-hours sessions. If you're passionate about MATLAB and eager to contribute to its development, we'd love to hear from you.
Bringing the beauty of MathWorks Natick's tulips to life through code!
Remix challenge: create and share with us your new breeds of MATLAB tulips!

A high school student called for help with this physics problem:
  • Car A moves with constant velocity v.
  • Car B starts to move when Car A passes through the point P.
  • Car B undergoes...
  • uniform acc. motion from P to Q.
  • uniform velocity motion from Q to R.
  • uniform acc. motion from R to S.
  • Car A and B pass through the point R simultaneously.
  • Car A and B arrive at the point S simultaneously.
Q1. When car A passes the point Q, which is moving faster?
Q2. Solve the time duration for car B to move from P to Q using L and v.
Q3. Magnitude of acc. of car B from P to Q, and from R to S: which is bigger?
Well, it can be solved with a series of tedious equations. But... how about this?
Code below:
%% get images and prepare stuffs
figure(WindowStyle="docked"),
ax1 = subplot(2,1,1);
hold on, box on
ax1.XTick = [];
ax1.YTick = [];
A = plot(0, 1, 'ro', MarkerSize=10, MarkerFaceColor='r');
B = plot(0, 0, 'bo', MarkerSize=10, MarkerFaceColor='b');
[carA, ~, alphaA] = imread('https://cdn.pixabay.com/photo/2013/07/12/11/58/car-145008_960_720.png');
[carB, ~, alphaB] = imread('https://cdn.pixabay.com/photo/2014/04/03/10/54/car-311712_960_720.png');
carA = imrotate(imresize(carA, 0.1), -90);
carB = imrotate(imresize(carB, 0.1), 180);
alphaA = imrotate(imresize(alphaA, 0.1), -90);
alphaB = imrotate(imresize(alphaB, 0.1), 180);
carA = imagesc(carA, AlphaData=alphaA, XData=[-0.1, 0.1], YData=[0.9, 1.1]);
carB = imagesc(carB, AlphaData=alphaB, XData=[-0.1, 0.1], YData=[-0.1, 0.1]);
txtA = text(0, 0.85, 'A', FontSize=12);
txtB = text(0, 0.17, 'B', FontSize=12);
yline(1, 'r--')
yline(0, 'b--')
xline(1, 'k--')
xline(2, 'k--')
text(1, -0.2, 'Q', FontSize=20, HorizontalAlignment='center')
text(2, -0.2, 'R', FontSize=20, HorizontalAlignment='center')
% legend('A', 'B') % this make the animation slow. why?
xlim([0, 3])
ylim([-.3, 1.3])
%% axes2: plots velocity graph
ax2 = subplot(2,1,2);
box on, hold on
xlabel('t'), ylabel('v')
vA = plot(0, 1, 'r.-');
vB = plot(0, 0, 'b.-');
xline(1, 'k--')
xline(2, 'k--')
xlim([0, 3])
ylim([-.3, 1.8])
p1 = patch([0, 0, 0, 0], [0, 1, 1, 0], [248, 209, 188]/255, ...
EdgeColor = 'none', ...
FaceAlpha = 0.3);
%% solution
v = 1; % car A moves with constant speed.
L = 1; % distances of P-Q, Q-R, R-S
% acc. of car B for three intervals
a(1) = 9*v^2/8/L;
a(2) = 0;
a(3) = -1;
t_BatQ = sqrt(2*L/a(1)); % time when car B arrives at Q
v_B2 = a(1) * t_BatQ; % speed of car B between Q-R
%% patches for velocity graph
p2 = patch([t_BatQ, t_BatQ, t_BatQ, t_BatQ], [1, 1, v_B2, v_B2], ...
[248, 209, 188]/255, ...
EdgeColor = 'none', ...
FaceAlpha = 0.3);
p3 = patch([2, 2, 2, 2], [1, v_B2, v_B2, 1], [194, 234, 179]/255, ...
EdgeColor = 'none', ...
FaceAlpha = 0.3);
%% animation
tt = linspace(0, 3, 2000);
for t = tt
A.XData = v * t;
vA.XData = [vA.XData, t];
vA.YData = [vA.YData, 1];
if t < t_BatQ
B.XData = 1/2 * a(1) * t^2;
vB.XData = [vB.XData, t];
vB.YData = [vB.YData, a(1) * t];
p1.XData = [0, t, t, 0];
p1.YData = [0, vB.YData(end), 1, 1];
elseif t >= t_BatQ && t < 2
B.XData = L + (t - t_BatQ) * v_B2;
vB.XData = [vB.XData, t];
vB.YData = [vB.YData, v_B2];
p2.XData = [t_BatQ, t, t, t_BatQ];
p2.YData = [1, 1, vB.YData(end), vB.YData(end)];
else
B.XData = 2*L + v_B2 * (t - 2) + 1/2 * a(3) * (t-2)^2;
vB.XData = [vB.XData, t];
vB.YData = [vB.YData, v_B2 + a(3) * (t - 2)];
p3.XData = [2, t, t, 2];
p3.YData = [1, 1, vB.YData(end), v_B2];
end
txtA.Position(1) = A.XData(end);
txtB.Position(1) = B.XData(end);
carA.XData = A.XData(end) + [-.1, .1];
carB.XData = B.XData(end) + [-.1, .1];
drawnow
end
Are you a Simulink user eager to learn how to create apps with App Designer? Or an App Designer enthusiast looking to dive into Simulink?
Don't miss today's article on the Graphics and App Building Blog by @Robert Philbrick! Discover how to build Simulink Apps with App Designer, streamlining control of your simulations!
From Alpha Vantage's website: API Documentation | Alpha Vantage
Try using the built-in Matlab function webread(URL)... for example:
% copy a URL from the examples on the site
URL = 'https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=IBM&apikey=demo'
% or use the pattern to create one
tickers = [{'IBM'} {'SPY'} {'DJI'} {'QQQ'}]; i = 1;
URL = ...
['https://www.alphavantage.co/query?function=TIME_SERIES_DAILY_ADJUSTED&outputsize=full&symbol=', ...
+ tickers{i}, ...
+ '&apikey=***Put Your API Key here***'];
X = webread(URL);
You can access any of the data available on the site as per the Alpha Vantage documentation using these two lines of code but with different designations for the requested data as per the documentation.
It's fun!
isstring
11%
ischar
7%
iscellstr
13%
isletter
21%
isspace
9%
ispunctuation
37%
2455 个投票
Hi to all.
I'm trying to learn a bit about trading with cryptovalues. At the moment I'm using Freqtrade (in dry-run mode of course) for automatic trading. The tool is written in python and it allows to create custom strategies in python classes and then run them.
I've written some strategy just to learn how to do, but now I'd like to create some interesting algorithm. I've a matlab license, and I'd like to know what are suggested tollboxes for following work:
  • Create a criptocurrency strategy algorythm (for buying and selling some crypto like BTC, ETH etc).
  • Backtesting the strategy with historical data (I've a bunch of json files with different timeframes, downloaded with freqtrade from binance).
  • Optimize the strategy given some parameters (they can be numeric, like ROI, some kind of enumeration, like "selltype" and so on).
  • Convert the strategy algorithm in python, so I can use it with Freqtrade without worrying of manually copying formulas and parameters that's error prone.
  • I'd like to write both classic algorithm and some deep neural one, that try to find best strategy with little neural network (they should run on my pc with 32gb of ram and a 3080RTX if it can be gpu accelerated).
What do you suggest?
Dear MATLAB contest enthusiasts,
I believe many of you have been captivated by the innovative entries from Zhaoxu Liu / slanderer, in the 2023 MATLAB Flipbook Mini Hack contest.
Ever wondered about the person behind these creative entries? What drives a MATLAB user to such levels of skill? And what inspired his participation in the contest? We were just as curious as you are!
We were delighted to catch up with him and learn more about his use of MATLAB. The interview has recently been published in MathWorks Blogs. For an in-depth look into his insights and experiences, be sure to read our latest blog post: Community Q&A – Zhaoxu Liu.
But the conversation doesn't end here! Who would you like to see featured in our next interview? Drop their name in the comments section below and let us know who we should reach out to next!
Hey MATLAB Community! 🌟
In the vibrant landscape of our online community, the past few weeks have been particularly exciting. We've seen a plethora of contributions that not only enrich our collective knowledge but also foster a spirit of collaboration and innovation. Here are some of the noteworthy contributions from our members.

Interesting Questions

Victor encountered a puzzling error while trying to publish his script to PDF. His post sparked a helpful discussion on troubleshooting this issue, proving invaluable for anyone facing similar challenges.
Devendra's inquiry into interpolating and smoothing NDVI time series using MATLAB has opened up a dialogue on various techniques to manage noisy data, benefiting researchers and enthusiasts in the field of remote sensing.

Popular Discussions

Adam Danz's AMA session has been a treasure trove of insights into the workings behind the MATLAB Answers forum, offering a unique perspective from a staff contributor's viewpoint.
The User Following feature marks a significant enhancement in how community members can stay connected with the contributions of their peers, fostering a more interconnected MATLAB Central.

From File Exchange

Robert Haaring's submission is a standout contribution, providing a sophisticated model for CO2 electrolysis, a topic of great relevance to researchers in environmental technology and chemical engineering.

From the Blogs

Sivylla's comprehensive post delves into the critical stages of AI model development, from implementation to validation, offering invaluable guidance for professionals navigating the complexities of AI verification.
In this engaging Q&A, Ned Gulley introduces us to Zhaoxu Liu, a remarkable community member whose innovative contributions and active engagement have left a significant impact on the MATLAB community.
Each of these contributions highlights the diverse and rich expertise within our community. From solving complex technical issues to introducing new features and sharing in-depth knowledge on specialized topics, our members continue to make MATLAB Central a vibrant and invaluable resource.
Let's continue to support, inspire, and learn from one another

The study of the dynamics of the discrete Klein - Gordon equation (DKG) with friction is given by the equation :
above equation, W describes the potential function :
The objective of this simulation is to model the dynamics of a segment of DNA under thermal fluctuations with fixed boundaries using a modified discrete Klein-Gordon equation. The model incorporates elasticity, nonlinearity, and damping to provide insights into the mechanical behavior of DNA under various conditions.
% Parameters
numBases = 200; % Number of base pairs, representing a segment of DNA
kappa = 0.1; % Elasticity constant
omegaD = 0.2; % Frequency term
beta = 0.05; % Nonlinearity coefficient
delta = 0.01; % Damping coefficient
  • Position: Random initial perturbations between 0.01 and 0.02 to simulate the thermal fluctuations at the start.
  • Velocity: All bases start from rest, assuming no initial movement except for the thermal perturbations.
% Random initial perturbations to simulate thermal fluctuations
initialPositions = 0.01 + (0.02-0.01).*rand(numBases,1);
initialVelocities = zeros(numBases,1); % Assuming initial rest state
The simulation uses fixed ends to model the DNA segment being anchored at both ends, which is typical in experimental setups for studying DNA mechanics. The equations of motion for each base are derived from a modified discrete Klein-Gordon equation with the inclusion of damping:
% Define the differential equations
dt = 0.05; % Time step
tmax = 50; % Maximum time
tspan = 0:dt:tmax; % Time vector
x = zeros(numBases, length(tspan)); % Displacement matrix
x(:,1) = initialPositions; % Initial positions
% Velocity-Verlet algorithm for numerical integration
for i = 2:length(tspan)
% Compute acceleration for internal bases
acceleration = zeros(numBases,1);
for n = 2:numBases-1
acceleration(n) = kappa * (x(n+1, i-1) - 2 * x(n, i-1) + x(n-1, i-1)) ...
- delta * initialVelocities(n) - omegaD^2 * (x(n, i-1) - beta * x(n, i-1)^3);
end
% positions for internal bases
x(2:numBases-1, i) = x(2:numBases-1, i-1) + dt * initialVelocities(2:numBases-1) ...
+ 0.5 * dt^2 * acceleration(2:numBases-1);
% velocities using new accelerations
newAcceleration = zeros(numBases,1);
for n = 2:numBases-1
newAcceleration(n) = kappa * (x(n+1, i) - 2 * x(n, i) + x(n-1, i)) ...
- delta * initialVelocities(n) - omegaD^2 * (x(n, i) - beta * x(n, i)^3);
end
initialVelocities(2:numBases-1) = initialVelocities(2:numBases-1) + 0.5 * dt * (acceleration(2:numBases-1) + newAcceleration(2:numBases-1));
end
% Visualization of displacement over time for each base pair
figure;
hold on;
for n = 2:numBases-1
plot(tspan, x(n, :));
end
xlabel('Time');
ylabel('Displacement');
legend(arrayfun(@(n) ['Base ' num2str(n)], 2:numBases-1, 'UniformOutput', false));
title('Displacement of DNA Bases Over Time');
hold off;
The results are visualized using a plot that shows the displacements of each base over time . Key observations from the simulation include :
  • Wave Propagation: The initial perturbations lead to wave-like dynamics along the segment, with visible propagation and reflection at the boundaries.
  • Damping Effects: The inclusion of damping leads to a gradual reduction in the amplitude of the oscillations, indicating energy dissipation over time.
  • Nonlinear Behavior: The nonlinear term influences the response, potentially stabilizing the system against large displacements or leading to complex dynamic patterns.
% 3D plot for displacement
figure;
[X, T] = meshgrid(1:numBases, tspan);
surf(X', T', x);
xlabel('Base Pair');
ylabel('Time');
zlabel('Displacement');
title('3D View of DNA Base Displacements');
colormap('jet');
shading interp;
colorbar; % Adds a color bar to indicate displacement magnitude
% Snapshot visualization at a specific time
snapshotTime = 40; % Desired time for the snapshot
[~, snapshotIndex] = min(abs(tspan - snapshotTime)); % Find closest index
snapshotSolution = x(:, snapshotIndex); % Extract displacement at the snapshot time
% Plotting the snapshot
figure;
stem(1:numBases, snapshotSolution, 'filled'); % Discrete plot using stem
title(sprintf('DNA Model Displacement at t = %d seconds', snapshotTime));
xlabel('Base Pair Index');
ylabel('Displacement');
% Time vector for detailed sampling
tDetailed = 0:0.5:50; % Detailed time steps
% Initialize an empty array to hold the data
data = [];
% Generate the data for 3D plotting
for i = 1:numBases
% Interpolate to get detailed solution data for each base pair
detailedSolution = interp1(tspan, x(i, :), tDetailed);
% Concatenate the current base pair's data to the main data array
data = [data; repmat(i, length(tDetailed), 1), tDetailed', detailedSolution'];
end
% 3D Plot
figure;
scatter3(data(:,1), data(:,2), data(:,3), 10, data(:,3), 'filled');
xlabel('Base Pair');
ylabel('Time');
zlabel('Displacement');
title('3D Plot of DNA Base Pair Displacements Over Time');
colorbar; % Adds a color bar to indicate displacement magnitude