# Making Correlation Plots between variables.

4 visualizzazioni (ultimi 30 giorni)
Bhavick Singh il 8 Set 2021
Risposto: Jaimin il 8 Ago 2024
I have voltage, current and power in a table. However, I need only the correlation plot of voltage vs current and voltage vs power. I do not need the histogram or the least square plot. What command or technique should i use to achieve this?
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
darova il 8 Set 2021
Use plot

Accedi per commentare.

### Risposte (1)

Jaimin il 8 Ago 2024
From what I understand, you are trying to plot the correlation between voltage and current, as well as between voltage and power.
For that, you can utilize the scatterfunction, or the plot function provided by MATLAB.
Here, I have attached a sample code using the scatter function related to the issue:
% Example data
voltage = linspace(0, 10, 100); % Voltage ranging from 0 to 10 volts
current = 2 * voltage + randn(1, 100); % Current with a linear relationship to voltage plus some noise
power = voltage .* current; % Power calculated as voltage times current
% Create a figure
figure;
% Scatter plot for Voltage vs Current
subplot(1, 2, 1);
scatter(voltage, current, 'b');
title('Voltage vs Current');
xlabel('Voltage (V)');
ylabel('Current (A)');
% Scatter plot for Voltage vs Power
subplot(1, 2, 2);
scatter(voltage, power, 'r');
title('Voltage vs Power');
xlabel('Voltage (V)');
ylabel('Power (W)');
sgtitle('Correlation Plots');
I hope this helps you resolve your issue.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su MATLAB in Help Center e File Exchange

R2021a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by